Sunan an-Nasa'i, Book 27, Hadith 45 (Nasa'i 3439)

It was narrated from Abu Hurairah that -(one of the narrators) 'Abdur-Rahman said:

"The Messenger of Allah -said: 'Allah, the Most High, has forgiven my Ummah for everything that enters the mind, so long as it is not spoken of or put into action.'"