I was having problems with my iMac G5 17" Rev A. It could not sleep. Once it went to sleep it immediately powered down. If I had firewire devices plugged in it could not turn back on. Even when I unplugged everything it still was a 50/50 chance of turning back on.
My work-around, never let it sleep. This is probably not a bad thing because it lets all the mx scripts run over night.
However, it still bugged me that my power supply was not acting right. I just received the replacement power supply and it was a breeze to install. Early in my iMac's life, I had the bursting capacitors and had to replace the logic board myself. Compared to that, replacing the power supply was a breeze.
AppleCare has been very good to me...1 replacement logic board and 1 replacement power supply costs way more than AppleCare.
So far the power supply is working as it should and my iMac is now sleeping correctly and powering off/on as expected.