I have the same issue.(iMac 2011 21.5”)
Symptoms: The last months fans run at full speed. Today morning when I was checking sites in Safari, the whole screen went white and the iMac restarted . After the restart the start sound was ok but the screen black and the fans at full speed.
Restarted many times but the screen always. I checked in the internet from another computer and saw many different causes for black screen.
I tried with external monitor in mini-displayPort and after 1-2 restarts it started on the external monitor
I also tried with this configuration pressing D at the boot to go to diagniostics but nothing was showing on the second monitor.
Then booted with the displayport and searched and found the TG Pro. Running it I saw temperatures around 30-40 deg C and the ODD and CPU fans at more than 4000.
I disassembled the machine and got out the logic board using instructions from ifixit. Sometimes on my pcs I use to repair, if they are old enough and have higher temperatures I change the thermal paste and are working very smoothly.
I did the same thing and changed paste on both the CPU and GPU.
Then after assembling and connecting it to power after some presses of the power button it started normally on the main internal screen and the external monitor as secodnary (ISSUE FIXED :) :) ).
I hope it will help other people.