It is narrated from Sayyiduna Abu Hurayrah (may Allah be pleased with him): "When Sayyiduna Thumamah (may Allah be pleased with him) accepted Islam, the Messenger of Allah (peace and blessings be upon him) ordered him to perform the ritual bath and pray two rak'ahs."
I say: Imam Ahmad bin Hanbal (may Allah have mercy on him) recorded it in his Musnad; Imam al-Bayhaqi (may Allah have mercy on him) also recorded it in his al-Sunan al-Kubra through the route of Abd al-Razzaq bin Hammam (may Allah have mercy on him), in which Sa'id al-Maqburi (may Allah have mercy on him) narrated from Sayyiduna Abu Hurayrah (may Allah be pleased with him): "Sayyiduna Thumamah al-Hanafi (may Allah be pleased with him) was taken captive, and the Messenger of Allah (peace and blessings be upon him) would come to him every morning and ask: 'O Thumamah, what do you have (to say)?' He would reply: 'If you kill me, you will kill a man whose blood will be avenged; if you show favour, you will show favour to one who is grateful; and if you want wealth, we will give you as much of it as you wish.' The Companions of the Messenger of Allah (peace and blessings be upon him) (may Allah be pleased with them) preferred taking a ransom and would say: 'What will you gain by killing him?' Then one day, when the Prophet (peace and blessings be upon him) passed by him, he accepted Islam. So he (peace and blessings be upon him) set him free, sent him to a garden of Banu Talhah and ordered him to perform the ritual bath. He performed the ritual bath and prayed two rak'ahs, and the Messenger of Allah (peace and blessings be upon him) said: 'How excellent and beautiful the Islam of your brother has become!'"