Hi srojtas
First reset the iMac's SMC (System Management Controller) exactly following the instructions in the following link.
http://docs.info.apple.com/article.html?artnum=303446-en
Then in the "Energy Saver Preference / Options" be sure that the box "Restart automatically after a power failure" is unchecked, just in case something else is interrupting the iMac's power at that time.
Lastly are you using elgato iTV? If so look at the discussions thread below!
http://discussions.apple.com/thread.jspa?messageID=4532472�
imac973 say's
+Ok, the problem seems to be resolved... I have deleted the file named "Wakein" located in /Libreria/Application Support/EyeTv...+
+Then I deleted and then reinstalled Eye Tv and...OK! my iMac doesn't restart by itself!!!+
Dennis