Using a GPIO pin as GND is noisy... why?
I'm assuming that your STM hasn't burnt out that it is running from an isolated supply. Switching a GPIO low isn't a dead short to ground. It is a connection through a tiny gold bond wire, through a transistor to a portion of the silicon die bonded by another little gold bond wire shared by a load of other circuitry to the ground pin of the chip and from there out to the PCB and the PSU ground.
Connect your 'scope ground lead to the PSU GND and the probe to the GPIO and you will be able to measure the voltage drop across the GPIO when low. You will see some noise due to voltages induced by the other currents being switched and passed through the common ground connection.