It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that a man came to the Prophet (peace and blessings be upon him) and said: O Messenger of Allah! Sometimes such thoughts come to me that I consider it better to fall from the sky than to utter them. Upon hearing this, the Prophet (peace and blessings be upon him) said "Allahu Akbar" three times and said: "Praise be to Allah who turned the matter back to mere whisperings."
Hadith Referenceمسند احمد / ومن مسند بني هاشم / 2097