Because I had a similar problem with a Treo 650 two years ago, I had a sneaking suspicion I knew what the issue was. With my old Treo I had used the headset and, after pulling it out, I was also unable to use the phone's regular speaker. I called Palm support at the time and they had me ship the phone to them. It was replaced with a refurbished model. The issue was one known to Palm. Occasionally the headset permanently disabled the speaker by breaking the hardware inside the headset jack that mutes the speaker.
So I went to the local Apple store. Because I got there at 6 p.m. on a Friday, the Genius Bar was already booked for the night. In fact, it was booked through Sunday morning. The earliest appointment I could get was at 2 p.m. Sunday. No one would help me until then. Just for the heck of it, I took the iPhone up to the AT&T store, and they wouldn't even talk to me about it. They said it was Apple's hardware and Apple's warranty, so I should speak directly to Apple.
Come Sunday afternoon, I headed back over to the Apple store. I explained my problem to the Genius, and he agreed that my assessment was likely correct. Because I had purchased the phone on the 29th, I was no longer eligible for a replacement phone. If the problem had occurred in the first 14 days of ownership, they would have given me a brand new phone on the spot, no questions asked. Instead, it had to be shipped back to Apple for repair under the terms of Apple's warranty. They did offer me an iPhone loaner for the days I'd be without my own iPhone, but I declined and just took my SIM card home instead. (I can't describe how painful it was to return to using my old phone for even a few days.)
I was told that the repair would take three days and I'd have my iPhone back on Wednesday. True to their word, my FedEx man delivered the repaired iPhone at 12:15 yesterday afternoon. It worked perfectly, though Apple did restore the device to its factory settings, meaning I lost all my data. I had to resync it with iTunes to replace my contacts, music, call history, and so on.
In the end, everything worked out fine. I must admit, though, that my confidence in the device has been shaken.