Nafi' (may Allah have mercy on him) said that Ibn Umar (may Allah be pleased with them both) used to observe voluntary fasts, and when he fainted he would not break his fast. The Shaykh (may Allah have mercy on him) said: This indicates that losing consciousness during a fast does not invalidate it.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصيام / 8110