Hi there,
It seems like you've been undergoing a lot of stress lately. It isn't uncommon to have withdrawal effects after stopping a medication. But what I think is, it could be a combination of both the med stopping and the surgery you had. Having surgery is a nerve wrecking thing for everyone. You naturally respond to it with anxiety. Anesthetics, definitely can give you headaches. It can also give you some short term memory loss.
Trying to harm yourself isn't the solution though... have you thought of talking to your doctor about how you feel? Maybe there are different coping skills or therapeutic ways to treat your depression.
As well, a lot of people do suffer from post-operative depression. Since a change has been made, whether it's good or bad, your body and soul has its own way of dealing with it. Chemical imbalances are just one of the causes.
We all go thru. change, big or small. It all depends on how effective we handle it. I hope you can figure out your thoughts and see a doctor. I wish you the best of luck. YOU are the reason why you want to get better. But seeking support, like posting here is the first step. I'm proud of you.
Stay well.