The simple answer is that part of rendering a scene involves converting world co-ordinates to view co-ordinates - where's all that stuff relative to my eyeballs, basically.
The view plane is the screen, which is what the mouse sits on. If your mouse co-ordinates are (xx, yy) then it is probably positioned at either (xx, yy, 1) or (xx, yy, -1) in view co-ordinates. You'll probably need to use a system where (0, 0) is the centre of your viewport on screen - not how mouse co-ordinates normally work, but constant offsets are easy enough.
zz=0 is where the player is, whereas the view plane is a short distance in front, between the player and what he can see. That's why the view plane is taken as either (xx, yy, 1) or (xx, yy, -1) here - if you use +1 (the normal case, I think) objects with view co-ordinates that have positive z are in front of you.
To convert this back to world co-ordinates, apply the same transform you do to transform your world co-ordinates to view co-ordinates, but backwards. You then get your mouse pointer position in world co-ordinates. To get the direction vector, subtract your player position.
The backwards conversion uses the inverse matrix at each step, and applies the steps backwards. In principle, all steps can be combined into a single matrix, and an inverse matrix can be calculated for the whole transform - but that's not the best approach. It's much easier, for instance, to calculate the inverse of a rotation than to calculate a general matrix inverse. If your transform from world co-ordinates to view co-ordinates is composed as needed from components (postion, orientation...) you really only need to calculate inversed components and combine them. Instead of 30-degrees-left (from world to view) you use 30-degrees-right (from view to world) etc.
If you're lucky, you might be able to drop the whole issue of player position completely - calculate the angle for the mouse pointer in view space (Euler angles are enough for this), then apply the orientation part only of the view-to-world transform.
No here's-the-formula, sorry, partly because the view-to-world transform depends on how you do the world-to-view transform and partly because I don't have an easy example to hand.
Though the question is different, you can find some relevant references in the answers here...
http://stackoverflow.com/questions/1283865/matrix-multiplication-view-projection-world-projection-etc