Just to validate your overall approach, has your CPU got a temperature sensor, and have you considered using this to trigger the system shutdown? I think you'll find that is quite a common approach, and makes it possible (using the freely available software) to adjust the PC power levels and fan speed and (if necessary) perform an orderly shutdown rather than just crashing the PC.