Just to add my experience with this..
I upgraded my wife's iPhone4 from ios4.3.2 to ios5.0 (her phone wasn't jailbroken, mine was.... haha), thinking I was really clever and expecting her to be grateful. However, she came back from work complaining she couldn't hear anyone via her EARPIECE. She had to either put on speaker mode or use a earphones (no problems with ios4.3.2).
Tried everything, change language to brits and back, played music and change to voice memos, put headphones in and out 10x times, blow into headphone port, clean headphone port with q-tip, but no dice...
Even upgraded to ios5.0.1. Not solved.
Then i read in another discussion whereby even brand new iPhone4S had the same problem https://discussions.apple.com/thread/3404857?start=795&tstart=0
They suspect it's something to do with Siri and voice control, switching from speaker to earpiece, whatever....
Finally tried Reset All Settings (under General/Settings), the earpiece sound improved about 40-50%, according to wife, so cancelled my plan to return wife's phone to the telco centre.
Pls backup your iPhone before trying this. It doesn't delete any media, messages or apps, it just resets all settings to Factory defaults, but pls backup anyway.... It may take about 10-20 mins, depending on how much 'crap' is in the phone.
Hope this helps while Apple fix this [definite] software bug...