When I unplug my headphones, my speakers (and headphones) stop working Happens intermittently:
When I unplug my Sony headphones, I am unable to get my 17" MBP (2.8ghz intel core 2 duo, running Lion), to make any sound. I've tried a handful of different hardware, and nothing will make a peep. 

Restarting "fixes" it.
Its a bug Lion has.

This thread should provide you with more info of users suffering the same bug.

This app claims to fix it (I found it on that same thread).

I haven't had the bug for a while, but I did have it quite a bit before. I really hope Apple fixes it, by 10.7.2 perhaps.

Hope it helps!

Edit: Probably the most relevant information in the thread is that it seems to be a bug on Core Audio. $ sudo killall coreaudiod quits the process and the system automatically restarts it, effectively providing a quick fix to the bug. The rest are people posting about their personal experiences and thanking the developer of the app that automatically applies this fix.