Burned ST LINK by connecting it to the board
The accidental mains-earth short. Don't we all make those one day.


You switched extension cord probably only switches one line.
That way you do not know whether it switched Line of Neutral unless you explicitly measure it relative to mains earth.
I'd recommend getting an isolator switch, an appropriate contactor, or just unplug.
Relays don't have enough distance and might get stuck on faults.
Your circuit does have a path from mains to earth when you connect the programmer. But we don't know the impedance of this connection.
Inside your PC the USB GND is connected to mains earth, and that's what has blown your ST Link.  




The slightest current this way may upset power supplies. Or blow inputs if you do not connect ground first. Which is why typical connectors always connect ground first. eg: USB, HDMI, VGA, DVI, SATA, PCI. Except audio, which you've probably noticed one day will create a loud humm when not inserted correctly yet.

I'd recommend getting an ST-LINK/V2-ISOL if you plan to work with circuit like this further. But beware, your oscilloscope has the same problem! You can use a differential probe with your scope.

Or buy an isolation transformer, that would remove the sparks on a fault. But can still result in strange behavior and shock hazards with a fault.

In the future, be aware of what potentials you connect. 



In a comment you state that resistors r4, r5 and r6 are 200k and r7, r8, r9 are 820 Ohm. This means there was a short trough r7,r8 and r9 to earth.
I'd recommend making these two resistor strings identical:  







simulate this circuit &ndash; Schematic created using CircuitLab

But you will have to take common mode noise into account.