What the circuit is designed to do
The following circuit is designed to accept a rectified (low frequency) sinewave input of amplitude 0-30V, and filter it through charging a capacitor until its voltage reaches a certain value settable via P1. I want the capacitor to be regulated between [7V;12V] when that happens. I thought that circuit would follow the input when not tripped, and oscillate around 12V (for example) when tripped. I was wrong.
Edit: To make it clearer, I am just trying to rectify a low frequency sinewave and make sure it's high enough to generate 5V. However the amplitude may be higher than the breakdown voltage of the capacitor, hence this protection circuit.
What the circuit does instead
To test the circuit, I've injected DC and increased the voltage until the protection tripped - set arbitrarily at 7V in my test. I was expecting the voltage of the capacitor to be saturated at 7V and stay there, but instead it leaked out quickly (a few seconds) down to ~1.5V and counting. I shut down the power supply and restarted the process, and the capacitor did the exact same thing: follow, then drop.