An electrolytic capacitor of 47uf/50V is charged through a 2M ohm resistor.When it charges to 13V, the circuit shuts down and the charge remains on the capacitor. To reset the shut-down state the power is switched off and then turned on. As the cap will take too long to discharge on its own or through a bleeding resistor, Ive used a NPN transistor that switches on for 5ms and grounds the cap. Is it safe to discharge the cap this way? The circuit seems to be working fine, no faults yet.
You need to figure out the ESR (equivalent series resistance) of the capacitor and with that and the peak voltage you can work out worst case current. That in turn can be compared against the transistor's ratings.
If the peak current is too high then add some further series resistance to reduce it. It will be kinder to everything.