Has there ever been anywhere a law criminalizing certain thoughts? The closest I can find is The Treason Act 1351, which is still in force in Britain today. This criminalizes compassing or imagining the death of the King. The statute goes on, however, to say that it is necessary that the offender be 'attainted of open Deed', so this is not a pure thought crime.
I am not counting the laws of religious bodies, just the laws of states.