I agree ... good advice from Mom, above.
No matter how much a lost love might hurt you emotionally, you have to get control of that pain/loss. It can take time, but you MUST work through it and go on in life.
I have heard of lost loves being painful to the heart; I've never heard of it causing heightened emotional stress follwoing masturbation. You said it makes you feel shame and disgust; makes me wonder if the reason is that you are using mental images or recollections of sex with her as your "turn on" and then you wish you had not after the climax. That, I could see happening. Most people use some kind of mental images or recollections or fantasies when masturbating; if that's where the problem comes in, you might want to create a new image or fantasy to use. With a little imagination you CAN create others that will work, and then you can be free of any need to keep using the X as your thought during masturbation. Otherwise, I think it is perfectly fine to think about an X lover if it turns you on and helps you to reach a climax and I am pretty sure it does NOT hurt anyone else when you do that (so there is NO need to feel shame or guilt over it).
Get counseling if you can't get this resolved within a few months after the date of the breakup.
Rob