It is sometimes (rarely) possible to erase the flash on the STM32 with high inrush current, it’s a really weird one. My boards went through a phase where I had to gradually increase the voltage instead of hitting them with 50V otherwise they would lose their firmware - but now they seem to be fine.