STM8 microcontroller burns when i plug in the ST-LINK (v1 or v2) programmer
Probably a grounding issue, with current flowing back through the USB port. If the 28V supply is left connected and the AC input switched it may be okay, but maybe not if my guess is wrong. 

There are a number of sure ways around it, one is to use a USB isolator module, which is probably a good idea for most development work that involves power circuits. 

What I think may be happening is that the 28V PSU Y safety cap is charging through the USB ground.