iPhone won't play sound in *some* apps
The reason why some apps played sound and other didn't is because individual iOS applications can decide whether their audio should play regardless of the mute switch state.
Apple recommend that if audio is critical to the usage of the app, for example a "teach me German" speech app then should probably ignore the state of the mute switch. However if the audio is superfluous to the main function of the application then it usually should not play when the mute setting is on.
Additionally an application can decide to blend its sound with existing iPod music playback, or to pause iPod playback when the application launches and manage sound exclusively by itself.
The mute switch does not affect sound through headphones.
When I can't get my music app to play, I restart my iPhone.
Works like a charm. Now it plays music with sound.