Wicked Thoughts is a fascinating article that appeared in September 2015 in Psychology Today. What should we do when we notice that some thoughts have arisen that are negative, dark or unspeakable? How may we maintain the balance of our mind and continue to be peaceful when such thoughts arise? The very last section of the article describes techniques.
The Guest House by Rumi (translated into English by Coleman Barks) also provides a beautiful answer:
The Guest House by Rumi
This being human is a guest house.
Every morning a new arrival.
A joy, a depression, a meanness,
some momentary awareness comes
As an unexpected visitor.
Welcome and entertain them all!
Even if they're a crowd of sorrows,
who violently sweep your house
empty of its furniture,
still treat each guest honorably.
He may be clearing you out
for some new delight.
The dark thought, the shame, the malice,
meet them at the door laughing,
and invite them in.
Be grateful for whoever comes,
because each has been sent
as a guide from beyond.
Just like the Psychology Today article, Rumi's poem suggests mindfulness and acceptance as the key techniques for handling wicked thoughts.