the same thing happened to me when i was fiddeling with the serial console, writing values i read from a potentiometer to the console. I ended up getting the "... out of sync ..." error when trying to upload differnt code, couldn't find the usb-port when reconnecting the board, etc.
Not to sure whether you can manually reset the code, as you call it, since you need a working serial/usb-connection to write code to the board and your compi can't find the board, as you said.
So, what i did, was just keep trying to get a connection to the board (pulling usb-plug, reconnecting, pressing the reset button), which eventually happened, and uploaded blink.
I think what happens is that you're kind-of-overloading the serial port with outgoing data and it is almost impossible to get the link into receiving mode: i recognized the tx-led on the board being lit all the time. What helped here was inserting a short delay() after each serial.print(), so that i can get the boards attention for a short while. I'm sure there are better ways (interrupts for example), but i'm only just starting to learn about arduino, so i hope this helps.