I think we need to separate the original thought from the thinking about it.
For example, if something that is obviously a racial stereotype enters our heads, we might think 'oh my God, how could I think that'. But, some folks have those thoughts, and guess what? They not only do not think the thought is bad, they go with it and deliberately reinforce it.
So the original thought itself does not seem to have any actual judgement attached to it, it just pops in there (We don't need to worry about how that happens for this discussion). If we think something innapropriate about someone, and then judge ourselves harshly for it, there was nothing unacceptable about that original thought. But, in the example above, if we then accept and reinforce that original thought to the point others might see us as racist, that original thought is also not unacceptable. This must be so, for the basic thought is the same in each mind in question, and while this may seem a baseless assumption, just try constructing a coherent argument to the contrary! (The problem is that unless you assume all people have equally valid initial thoughts, you are on the slippery slope to 'ranking' human beings, a practice still in vogue in some parts of the world, excusing a whole host of evils, including slavery, rape, and genocide!)
The thoughts that may be unacceptable are those that judge the original thoughts that spring into our minds, seemingly unbidden. And this is a huge can of worms. I don't think it is right to just assume that you can be the only judge of these thoughts, because you cannot exist in isolation. So others are always going to be affected by the nature of your reaction to your thoughts, for example, your behavior towards them after a possibly innapropriate racial stereotyping thought. So the judgement of these 'thoughts about thoughts' is a complicated process, which has never really been considered as such insofar as I am aware, but actually, and almost incidentally, forms the basis for human group interaction.
And there is another factor here too. The methods we pick up to judge our own thoughts are largely socially transmitted. Consider a child having a 'bad word' they have heard somewhere pop into their head. How does the parent react if the child chooses to say that word? Pretty much every parent makes an issue of it, with 'panicky' behaviour, screaming, hitting, or sternly telling off, etc. It makes no difference to the end result. That child will always have problems dealing with those internal thoughts. Because the only model they have is one of panicky reaction. This is why having grandparents around is often a calming affect on children. Most older people might just laugh, or make that funny clucking noise that only grandmothers can make properly, and offer the child another scone. That child might learn to handle their thoughts better.
When we disturb ourselves over thoughts that we see as unacceptable, it is due to our poor handling of those thoughts, not the thoughts themselves.
Sorry about the ramble, but this is actually rather a complex issue, and even this is only glossing over the main points as I see them. But it is so relevant to much I have read on this forum. We waste so much time beating ourselves up about our own thoughts, because the mechanism for handling them is broken, or improperly formed. Getting through that problem is a major mile marker on the road to mental health.
And no, I have not reached it yet, but I am on the road!
John.