I had to reboot, but to summarize the thread's problem and apparent solution, which worked for me (but only for a week): The problem occurs if your macbook goes to sleep with earphones plugged in for a sufficiently long time (more than 1h) when it wakes up audio won't work. ALSO some people notice overlay for changing volumes doesn't respond (it actually did for me), and plugging in or removing headphones doesn't trigger any change in the sound settings as to which device (speakers or headphones) is displayed for output.
You should try to trash the com.apple.audio.DeviceSettings.plist and com.apple.audio.SystemSettings.plist in /Library/Preferences/Audio and reboot with a reset of pram (hold command-option-p-r before you power on, and until you hear a second boot "bong" sound). This stopped it from recurring for me when the laptop went to sleep with headphones plugged in - for a week; later it happened again when sleeping while the quicktime player was playing an mp4 video with headphones plugged in.
As an aside I have another sleep-waking issue where the network won't reconnect properly (wifi, to an 802.11N access point) but instead will show it's connected to the right point, and no traffic will go out (E.G. can't ping 22.214.171.124, nor 192.168.0.1) this was also supposed to go away if one clears pram, but it did not. The work around there is to turn off wifi, and turn it back on.
There's even a rumor that if you always use the power adapter that came with your macbook pro retina the pram fix will stick, while switching to an adapter with the old style magsafe plug causes it to recur. It gets a little too tin-foil-hat for me.