Interesting, I was having sound problems just yesterday but this is a 20 inch iMac.

No sound at all, went on for 2 days. and got the same theres no output devices listed.

What I did;
1- Messed around (system preferences for sound)
2 - Rebooted

Got sound back
Next day lost sound again.

3 - Ran disc utility
4 - Ran / downloaded the latest system updates

Got sound back but lost all sound after a few hours.

5 - Unplugged the external speakers and plugged back in <-- working now, well so far.