A man from the Ansar embraced Islam, then apostatized and joined the polytheists, after which he came to regret what he had done. He sent word to his people, saying, "Ask the Messenger of Allah ﷺ for me whether there is any chance of repentance for me."His people came to the Messenger of Allah ﷺ and said, "So-and-so has come to regret what he did, and he has asked us to inquire of you whether there is any Tawba available to him."Then the verse was revealed, "How shall Allah guide a people who disbelieved after their belief..." up to His words, "...Forgiving, Merciful" [Aal Imran 3:86–89].So he sent word to him, and he embraced Islam.
أخبرنا محمد بن عبد الله بن بزيع قال حدثنا يزيد وهو ابن زريع قال أنبأنا داود عن عكرمة
كان رجل من الأنصار أسلم ثم ارتد ولحق بالشرك ثم تندم فأرسل إلى قومه سلوا لي رسول الله ﷺ هل لي من توبة فجاء قومه إلى رسول الله ﷺ فقالوا إن فلانا قد ندم وإنه أمرنا أن نسألك هل له من توبة فنزلت {كيف يهدي الله قوما كفروا بعد إيمانهم} إلى قوله {غفور رحيم} فأرسل إليه فأسلم
Sourcing, its isnad is sahih. Ahmad narrated it, 247/1, from the hadith of Dawud bin Abu Hind, as above. It is also in Kubra, no. 3531. Ibn Hibban graded it sahih, no. 1728, as did Hakim, 2/142 and 366/4, and Dhahabi.