I have the same problem with a refurbed model I bought from BestBuy.ca with 4 years of Bestbuy warranty... The computer clicks and shuts off as if the cord got unplugged, then reboots. Sometimes happens during the boot process, other times during regular usage (though seems to be frequently triggered by GPU usage... but not consistent).
Same results with Lion, Mavericks and Yosemite. Pretty sure it's hardware.
BestBuy Geeksquad replaced the logic board, and it still crashes. I, like you, have tried different cord, different outlet, with and without UPS, all with the same random results. Other 2008 iMac in same UPS is solid. I have to assume it's the power supply.
Going back to best buy tomorrow for them to send away again. Their no-lemon policy states that if they replace hardware 3 times, they'll give me a whole new equivalent or new current model as a replacement. I'm looking forward to my brand new 27" iMac soon!!