This isn't on an iPhone 4, but my girlfriend is experiencing the exact same thing with her 3G. Out of the blue her mic doesn't seem to work anymore. Sometimes it works like 15 seconds speaking with someone, but then her voice gets garbled, or cuts out entirely, and the reciever can't hear a thing she says.
As said, this came out of the blue, without dropping the phone or anything. Her 3G is 2 years old now, and never had any problems before.
We've tried replacing the mic, restoring as new, cleaning out the jack-connector and what not. Nothing has helped at all. It's weird, because sometimes it works with the speaker turned on during a call, I mean, you can hear your own voice on the phone, but the reciever can't hear anything. We've also tried with the headset, and a bluetooth headset, which works fine.
I'm guessing it's a software bug somewhere really. Hope someone could find out whats going on though.