Hakim bin Hizam (may Allah be pleased with him) said: I said: O Messenger of Allah! What do you think about the deeds I used to do in the Days of Ignorance with the intention of righteousness, such as freeing slaves and maintaining ties of kinship? Will I receive a reward for them? The Prophet (peace and blessings be upon him) said: "You have embraced Islam along with the good deeds you did before."
Hadith Referenceالمعجم الكبير للطبراني / باب الحاء / 3073