Hi,
First of all, a warning: Compact Macintosh computers contain high-voltage circuits. Charges can remain in certain components even after the machine has been switched off and disconnected from the mains. All work inside can be very dangerous. Opening and repairing such computers must only be carried out by someone with the necessary expertise.
It is difficult to say what could be the exact problem in this case. To begin with, a service technician would probably check the logic board battery voltage, disconnect and reconnect cables, and remove and reinstall memory modules. Also, a careful inspection of boards may show signs of leaking electrolytic capacitors.