Yes, every thoughts in mind create permanent impression on mind which is stored as Sanskara in subtle form and they can active anytime in future and can make their effect to be experienced. So, it's advised to pacify and suppress such thoughts.
Swami Vivekananda explained this in Raja Yoga: Chapter 2:
The Chitta-Vrittis, the mind-waves, which are gross, we can appreciate and feel; they can be more easily controlled, but what about the finer instincts? How can they be controlled? When I am angry, my whole mind becomes a huge wave of anger. I feel it, see it, handle it, can easily manipulate it, can fight with it; but I shall not succeed perfectly in the fight until I can get down below to its causes. A man says something very harsh to me, and I begin to feel that I am getting heated, and he goes on till I am perfectly angry and forget myself, identify myself with anger. When he first began to abuse me, I thought, "I am going to be angry". Anger was one thing, and I was another; but when I became angry, I was anger. These feelings have to be controlled in the germ, the root, in their fine forms, before even we have become conscious that they are acting on us. With the vast majority of mankind the fine states of these passions are not even known — the states in which they emerge from subconsciousness. When a bubble is rising from the bottom of the lake, we do not see it, nor even when it is nearly come to the surface; it is only when it bursts and makes a ripple that we know it is there. We shall only be successful in grappling with the waves when we can get hold of them in their fine causes, and until you can get hold of them, and subdue them before they become gross, there is no hope of conquering any passion perfectly. To control our passions we have to control them at their very roots; then alone shall we be able to burn out their very seeds. As fried seeds thrown into the ground will never come up, so these passions will never arise.
He has also given one practice to pacify or suppress such thoughts - That's *with the help of opposite or contrary thought(10th Sutra:)
ते प्रतिप्रसवहेयाः सूक्ष्माः ॥१०॥
10. The fine Samskaras are to be conquered by resolving them into their causal state.
Note: The book of Rajayoga I have been reading presented one example which I don't find underneath this (10th) sutra but the same example I found presented underneath 33th sutra:
वितर्कबाधने प्रतिपक्षभावनम् ॥३३॥
33. To obstruct thoughts which are inimical to Yoga, contrary thoughts should be brought.
That is the way to practise the virtues that have been stated. For instance, when a big wave of anger has come into the mind, how are we to control that? Just by raising an opposing wave. Think of love. Sometimes a mother is very angry with her husband, and while in that state, the baby comes in, and she kisses the baby; the old wave dies out and a new wave arises, love for the child. That suppresses the other one. Love is opposite to anger. Similarly, when the idea of stealing comes, non-stealing should be thought of; when the idea of receiving gifts comes, replace it by a contrary thought.
How thoughts stored as Sanskara and cause for effect of joy and grief is explained in 16th Sutra:
हेयं दुःखमनागतम् ॥१६॥
16. The misery which is not yet come is to be avoided.
Some Karma we have worked out already, some we are working out now in the present, and some are waiting to bear fruit in the future. The first kind is past and gone. The second we will have to work out, and it is only that which is waiting to bear fruit in the future that we can conquer and control, towards which end all our forces should be directed. This is what Patanjali means when he says that Samskaras are to be controlled by resolving them into their causal state (10th Sutra).