Maybe you could try thinking in something else every time that comes to your mind and distract yourself and give less importance to that thought. Maybe singing a song, multiplying 3 or more digits number in your head? Or do something with your hands that requires attention, like juggling 3 balls or moving a coin around the wingers with one hand, find something fun or hard that you can think or do that will make you impossible to have the tough you don't like at the same time while doing the activity.
At least that would be what I would do to try to delete an idea from my brain and think in something else.
Hmmm if the thought can be eliminated the second thing you could do is accept that your brain likes to think that, just because you think in something, doesn't mean you have to do what you think, you know you are better than that. As long the thought stays in your mind and you have self control to not make it reality, just let it linger and ignore it.
I have a problem like that, I think and want to do something but I promise myself I won't ever do it, doing it for real would make me feel bad but thinking about doing it, I have no problem with that, I have accepted I like that thought and can't help it, but that doesn't mean will accept performing it for real and I won't do that for real.
Hope that helps, I dunno if I'm good giving advices. Just in case, ignore my advices till you see more people saying my advices are good