Sayyiduna Imran bin Husayn (may Allah be pleased with him) narrates this saying of the Prophet (peace and blessings be upon him): "My Ummah has been pardoned for what they think about within themselves, as long as they do not speak of it or act upon it."
Al-Tabarani recorded it. Its chain contains al-Mas'udi, who suffered from confusion (ikhtilat) in his memory; the rest of its narrators are the narrators of the Sahih.
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الحدود والديات / 10503