Getting loads of urges, but reason is different

Since Yesterday am feeling slightly depressed, don’t know for what reason but not feeling good at all.
And in the depressed state I checked my toxic ex-narcissist gf on social media to see as what she is doing now a days, so i saw that she is hanging around with another guy on bike and enjoying, glowing in the video. Firstly i was indifferent to that post and didn’t feel any jealousy about her new supply, but later on i started thinking why is that God is keeping her happy and to me depressed. So this additional miserable thought made me more miserable and depressed since yesterday.
Then this urges started coming in for PMO, not because i am desperate for PMO but my mind is trying to seek pleasure in this miserable state.
I have been a victim of this thought cycle where firstly mind will feel pain and miserable feelings due to any reason and sometimes for no reason, just a feeling will develop that I am Sad and depressed, and then after sometime it will find means to seek pleasure as a medicine and generally goes for the PMO as mind thinks it is the most easiest and pleasurest way to get the pleasure and numb the issue.
First create a problem in mind and then seek medicine (PMO), was tricked very badly.
Have to stop being depressed,stop checking my ex on social media, and stop overthinking to stop relapses. Though I haven’t relapse yet but getting some pulsating sensation at my Root chakra spot.