Sahih Muslim, Book 45, Hadith 60 (Muslim 6491)

'A'isha reported Allah's Messenger (ﷺ) as saying:

A believer does not receive (the trouble) of running a thorn or more than that but Allah elevates him in rank or effaces his sins because of that.