First time I've posted on here - been a veiwer for a while though! There's probably some clever forum nickname for someone who does that...
I felt compelled to on this one though, as I sounds like a problem I've seen on a few iPhone 3Gs.
When you say that you suspect the phone has locked up, do you mean that the button on the front has become unresponsive? Or is the phone actually giving you a message saying that it is locked? The reason I ask is that the front button, charge / dock connector, microphone and speaker are all connected to the same piece of circuit board. If one doesn't work, usually all them don't work. It could be that the phone is fine, just that it can't be 'woken-up' using the front button as this section of the phone has become detached from the main circuit board... It's fairly common (especially on older 3Gs, when the rear casing has become worn and has a bit of play in it) for this connector to detach.
There are plenty of online tutorials in how to dismantle the phone, you don't need to go the whole of the way through. It's connector 4 that you're interested in; the one on the left, near the bottom of the phone. Make sure that one's secure. There's no need to unplug 1,2 and 3 as the videos will suggest, as you're not completely dismantling the phone.
Obviously, if it's fairly new, doing this will invalidate your warranty!
Feeling brave?