Does this mean you now have sound again?
Let me get this correct, you have gone into Sound in System Prefs, made sure its on internal, ie, your iMac speakers, and then tested to see it works?
If your Sound Pref's keep changing, not sure what the issue is - first best make sure its not a hardware issue - run the hardware tester that comes with your install discs - this should give an idea if you have any issues.
If its software, just re-install is my advice if you have a back-up.
I always do a Custom Install and only instal whats necessary, that being the basic OS, forget fonts, languages or printer drivers - install these later and as required.
After OS instal, check with disc warrior or similar app, even good ole disk repair in utilities, verify and repair permissions.
If you still have issues and its within its 14 day exchange period, change it or else it will be in for a repair.