Thinking further about it, I'm remembering the commandment not to covert thy neighbor's wife. Covet means think, so maybe Yeshua was right regardless of how the mind works? Comes down to Thought Crime via Orwell's "1984." Thus I wasn't sure how a thought could be sinful or criminal, but as I realize now God does make covetting sinful so, ya maybe. :)
39. This shall be fringes for you, and when you see it, you will remember all the commandments of the Lord to perform them, and you shall not wander after your hearts and after your eyes after which you are going astray. Numbers 15
14. You shall not covet your neighbor's house. You shall not covet your neighbor's wife, his manservant, his maidservant, his ox, his donkey, or whatever belongs to your neighbor." Exodus 20
These are both 'thought-crimes.' As as I recall the Yeshua bit he said like "...the Jews say do not commit adultery [differentiating between thinking it, and doing it presumedly] but I say to you, "a man who looks at his neighbor's wife with lust in his eyes has already commiting adultery with her.""
Problem here is it clashes with Torah when it says you shall not add to Torah, nor take away from it (1. Everything I command you that you shall be careful to do it. You shall neither add to it, nor subtract from it. Deuteronomy 13.) The prohibition from God given by Moshe is actually commiting adultery. Yeshua then (seemingly) adds his own additional clarification to the Law by saying you shouldn't even think about it too.
So would say it's probably a good idea not to think it (adultery.) But there are problems as with Deuteronomy 13:1
Btw, I believe Christian OTs have 13:1 as 12:last due to numbering errors or other issues.
It's a heart action I think, if you enjoy entertaining thoughts of lust/coveting, then it's a sin. I don't think random thoughts count unless you realize what you're thinking and then still harbor them and wish for them to happen, etc. You know...like wanting a sports car isn't "wrong", but wanting your neighbors sports car and thinking you deserve it more than he does, even though you know it's wrong to think that stuff, is sin.
Having a thought is not a sin. Was not Yeshua tempted? Did He sin? Cain was warned by God that sin was crouching at the door and that he must master it or be mastered by it, obviously referring to Cains "thought" of Abel. Yeshua's teaching on the Torah does not add or subtract, rather it explains, illuminates, unfolds. Yeshua taught the "spirit" of the law and that it is more important to keep the spirit of the law than the letter of the law. The letter begets death, the Spirit begets life.