I was able to run AHT test with external monitor plugged in: I get the error4SNS/1/C0000008: TL0p - - 124. Related to the temperature sensor on LCD panel, which is odd because when I am doing the testing the lcd panel is not plugged in. That leaves me with the actual sensor on the mainboard. I have looked up my history on ifixit and this is the exact error I received when I wasted a brand new lcd panel on another iMac a couple of years ago. I think we have our answer: mainboard needs replacement because of bad temp sensor. I will recommend not replacing the mainboard as this is a late 2009 model, and the prices to get one in Canadian dollars is outrageous.
I recently replaced the glass and it did not boot up afterwards, no lights, nothing. Noticed the antenna and bluetooth cables exposed, i.e. black cable covering not there, where the cables come out of the display. I don't know how this happened but a piece of black electrical tape around the silver exposed parts did it for me.