this. THIS THIS THIS THIS THIS.
THIS.
THIS.
if i could make my font huge, i'd do it. now, granted, this only happened on my edge iphone, and hasnt happened on my 3g one (granted, havent used headphones a lot with it, so ymmv).
but fuck. holy hell. i have no idea what caused it, besides having used headphones previously. but the phone then gets stuck in headphones mode. turning it on and off, muting it, flipping the silent switch, everything, it just thinks it needs to output sound to the headphone jack. i dont know if there is something in the phone that detects if headphones are there and gets messed up, but if you get this error (by pulling out the headphones while sound is playing -- this was the cause once for me), then you are screwed.
however, the ONLY way i could figure out how to fix it, was mess with plugging headphones in and out, while playing/not playing music. it was never repeatable, and no surefire combination to get it to work. just plugging in headphones, listening to music, maybe pausing the music, unplugging headphones, then playing music again, hoping it comes out of the speaker, which is what should happen. it doesnt work 100%. it doesnt happen 100% in getting stuck in headphone mode.
but once you get stuck in headphone mode, the ONLY WAY i could figure out how to fix it was to plug in some headphones and keep messing with it. so i always kept the iphone white headphones in my backpack, just in case i was listening to music through my car stereo (via line in) and in unplugging it it got stuck.
man, just reading your post reminded me of the sheer frustration with the whole thing, which happened a good 8-10 times over the last year.