I just noticed this on my iPhone 4 after updating the OS to 4.0.2 last week: When I start playing anything in iTunes (audiobooks or songs), the volume is very low and needs to be boosted way up to hear; but after an audio alert rings, the audio level jumps up to normal and I have to quickly turn it down. This happens both out of the headphone jack and out of the Dock. (I use a Dock connector to hook up to the audio system in the car.)
My workaround is to open the Settings>Sound and play the "Tri-tone" alert after starting iTunes. As soon as the Tri-tone finishes, the volume in iTunes will jump up to normal.
MacPro 2x2.8 Quad Core, 17" MacBook Pro,
Mac OS X (10.6.2)
For what it's worth, I found a another way to reset the volume when it's too low: I hit the "rewind" 30 seconds icon. The track backs up 30 seconds and the volume comes back to normal.
I seem to have cured it by trying some something I read about in relation to Mail not working. I deleted all the applications running in the background then restarted the iPhone. (Click Home button twice to show background apps, then tap and hold on an app to bring up the delete option.) I had over 20 apps active in the background.