That's usually how people do things isn't it?
No it is not. They are the invention of the devil. Straight to solder. It seems only the solder-less system worked and when it was soldered up:-
I soldered the circuit onto a printed breadboard and it now spits out random numbers while the optical sensor is blocked... I thought there was a short so I desoldered and resoldered the board to make sure everything was correct.
So taking things apart and then putting them back together is the sort of stupid fault finding technique that using solderless bread board makes you do. In this case doing it with a soldered circuit is plain silly.
The soldered circuit didn't work because you wired it up wrong, simple as that. The random numbers bit implies that the input was floating.http://www.thebox.myzen.co.uk/Tutorial/Inputs.html
Even though that was not the intention that is what was wired up. That is what is happening here.
However, the alternative explanation is that the laws of physics suddenly got reversed one time due to negative energy flow caused by bad kama. I'm off to hug a tree.