I used to do it pretty regularly but stopped. For relationships that have ended and for which there is no hope or desire of resurrection I made the choice not to tease myself mentally with re-living something which will never happen again. I found that stopping that helped me to move on because I stopped reinforcing those feelings by masturbating to those experiences. With random porn it's emotionally different because they're all just anonymous strangers with which you have no emotional connection.
I agree with you, but in my situation this happens only when I am heartbroken from a break up. By the time I have moved on or met someone else and started something new, I am capable to masturbate thinking previous lovers / crushes without feeling sad after I cum.