I first saw this done on one of those Sketchup tutorials from back in the day, 2006/7 or something, and didn't really get what the fuss was about. Now in 2011 after having done some photo/ camera matching manually in Blender I see why the Sketchup approach is pretty awesome. I'm coding this as much for the experience as i am for the end result.
Currently the state of my addon is moments before adding some preliminary resection algorithms, based on a very much simplified version of this image:

At the moment my script allows for the user to align the X/Y guides with the perspective in a photo, the script then generates lines towards the vanishing points and draws the resulting horizon. The next step is to implement this 4 part equation to arrive at the camera position. Seems trivial, but i don't know until i sit down to write the code.
The code so far is available, with some comments on the BlenderArtists forum thread :
Blender-2.5-Camera-Matching-Script
It seems to generate some interest, so if i fail, somebody is bound to be able to provide some insight. After all, some of the boring GUI work has been done already.





