Does your music only play out of one speaker?
I was only hearing music played out of the left channel, either with or without headphones and also when played through a dock.
I found the solution:
Go to Settings : General : Accessibility and slide the L - R slider to the middle. Now the music plays out of both the L and the R speakers.
(If you tap the mono button there, then you will also hear sound out of both speakers, but you won't hear stereo effects, so don't do that).
iPhone 4, iOS 5.0.1