فَمَن يَعْمَلْ مِنَ ٱلصَّـٰلِحَـٰتِ وَهُوَ مُؤْمِنٌ فَلَا كُفْرَانَ لِسَعْيِهِۦ وَإِنَّا لَهُۥ كَـٰتِبُونَ Qur’an Al-Anbiya (21:94)Faman yaAAmal mina a l ssa li ha ti wahuwa muminun fal a kufr a na lisaAAyihi wainn a lahu k a tiboon a
I.e., even a breach of religious unity may not be unforgivable so long as it does not involve a worship of false deities or false moral values (cf. verses {98-99} below): this is the meaning of the stress, in this context, on man's being "a believer withal" -an echo of the principle clearly spelt out in 2:62 and several other Qur'anic passages.
Allah gives credit for every act of righteousness, however small: when combined with sincere Faith in Allah, it becomes the stepping stone to higher and higher things. It is never lost.