A Jeremy said, the circuit that the extension cord is plugged into is most likely overloaded, drawing too many amps, tripping the breaker or blowing the fuse. And caution should be used in using any extension cords for high wattage devices like heaters. What's marked as "Heavy Duty" today usually isn't heavy duty enough, the wire size usually being too small to carry the load.
I just recently had a 10ft "Heavy Duty" cord burn in half, practically exploding, sending sparks and ashes aprox. 6ft in all directions. It was 18 awg stranded wire, which should have been able to carry the load, especially over only 10ft in length. Fortunately it was in my reptile room which has a painted concrete floor with nothing flammable around. This happened after about 2, maybe 3, weeks of use.
As for what caused the intial melting, it was most likely due to arcing between the contacts of the outlet & heater plug. Over time the insulated material surrounding the blades of a plug tends to break down from the heat caused by the flow of electricity. Once this material breaks down, gets weak, the metal contact blades begin to flex as they heat and cool, in unison with the on/off of the heater. When the blades flex, move, it creates an arc between the blades and the metal contacts of the outlet. This increases over time and results in melting.
Always make sure a plug fits securely in an outlet and isn't loose. No matter what the appliance or device is. I always spread my plug blades out as far as they'll go and still fit into the outlet. The grounding part of a three-prong plug aids in stabilizing the connection, but they don't put them on most portable heaters.
For my reptile room or outdoor use I make my own extension cords out of 12 or 14 gauge solid wire. The cord that exploded on me was picked up at a flea market as a temporary quick fix at the spur of the moment. Rest assured it won't happen again. The thing is, I even thought about what was going to happen while thinking about buying it but I blew it off. I knew better but didn't do better.
Have a good one!
HH
-----
Due to political correctness run amuck,
this ol' hillbilly is now referred to as an:
Appalachian American