Yes, unfortunately Apple seem to have dropped the ball on this one, though they say it only affects a small number of iMacs.
If you read all the posts you'll see the iMac Graphics Firmware Update fixes this problem.
If you can get the machine to stay stable for 10 mins, run software update (Apple menu) and apply this fix. You may need to apply other patches before this one appears.
http://docs.info.apple.com/article.html?artnum=307008
Some people have found the problem varies between boots, so if you get a hang keep rebooting until it's stable. If no joy, as MacBookC2D123 says, take it back.