Sayyiduna Abdullah (may Allah be pleased with him) says that a man came to the Messenger of Allah (peace and blessings be upon him) and said: "O Messenger of Allah! Will we be held to account for our deeds of the Jahiliyyah?" He (peace and blessings be upon him) said: "Whoever does good deeds in Islam will not be held to account for his deeds of the Jahiliyyah, and whoever does evil will be held to account for all his deeds, the first and the last."
By this he (peace and blessings be upon him) meant only the Hereafter; it is as though he made faith an expiation for his past disbelief, and made righteous deeds afterwards an expiation for all his past sins other than his disbelief.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / 18292