Sahih Muslim, Book 45, Hadith 63 (Muslim 6494)

'A'isha reported:

Allah's Messenger (ﷺ) said: There is no trouble that comes to a believer except that it obliterates from his sins, even if it is the pricking of a thorn