If the power switch is internally stuck in the "pushed" position, it will have the same effect as if a person were holding the button down. The motherboard interprets a held-down power button as a signal to shut down. But if this is what's happening, then 1)
beatle's test will reveal it, and 2) the motherboard would power up immediately when the power supply were plugged into the wall, then power down after about five seconds.
The other likely possibility is that the motherboard is getting an emergency shutdown command from the CPU. If the CPU is an AMD, the reason it's overheating that fast is going to be a lack of thermal transfer from the CPU to the heatsink. Lack of thermal transfer is usually caused by a heatsink that is on
backwards instead of
the right way, but sometimes by a person using a shim, or forgetting to use thermal grease, or forgetting to take the coverslip off their thermal patch.
Special cases: the clip's in the heatsink backwards (common with ThermalTake Volcano 7+, which comes disassembled), or a heatsink that has some room to move back & forth on its clip and it's too close to the raised, solid-plastic end of the CPU socket and has ridden up on it (common with Thermalright SK-7 and SLK-800/A).