Hi,it could be a dry joint on the flyback transformer(that's why it work's upsidedown),it's the black "box" that the thick red lead from the back of the tube goes to.BUT THIS PRODUCES 25 THOUSAND VOLT'S and WILL KILL YOU if you don't know what you are doing.A(good) tv repair shop might be cheaper than Apple to get this fixed.The iMac's seem to do this sort of thing a lot just see how many are on e bay with the same type of fault !!BTW don't put OSX on it till you have updated the firmware or this problem will seem minor.(just google iMac OSX upgrade)
Andy Dacosta, January 2006