When I unplug my headphones, my speakers (and headphones) stop working
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.