Having those kinds of attacks are HORRIBLE. I have had something similar. For a few weeks after I would eat lunch (normally a bread filled meal) I would start to get brain fog and have this tingly/warm feeling in my arms and legs. Not long after my vision would change; everything would get really far away and blurry. The same far off feeling would happen with my hearing, too. The spell itself takes about 10 minutes or so and I never actually lose consciousness but I definitely feel a major energy drain for 2-3 hours afterward and still am not back to normal until the next day.
The first thing my doctor did was get me to a Cardiologist to check on my heart. Everything is fine except that he is changing around my meds. Apparently my internist (that I don't see anymore) put me on some heavy diuretic for my Edema and that's part of what's causing my rapid heart rate.
In the middle of the cardiologist visits and testing I finally got fed up with my stomach issues and my doc sent me to a GI doc. My endoscopy and colonoscopy are scheduled in about 2 weeks. In the mean time I've done a ton of research. I haven't found anything yet that connects fainting (or near fainting..) with Celiac BUT after thinking about it I can see how it could be connected. Here's why. Think about what happens to a diabetic when they have too much sugar...they can actually go into a coma if it's bad enough. I know for me I get a euphoric feeling and then plummet to the depths of what feels like Hell when I eat too much sugar. Wouldn't it stand to reason that if you're body can't cope with gluten and you give it a mega dose that it could cause some kind of fainting like spell? That makes total sense to me. Of course, I'm no doc...but there has to be a connection.
After doing a lot of research and trying a LOT of medicines, I have found what you are explaining to be very closely related to having Celiac disease. I experienced a lot of what you are saying times a million (not to say that my case was worse) I was diagnosed with multiple sclerosis from one doctor, having epilepsy from a couple neurologists and having a heart defect... BUT never any proof. One well known specialist went as far as to tell me that it would be decades before there would be technology to prove my disease. Long story short, I had all kinds of neurological symptoms such as seizures, migraines, speech problems and neuropathy. It went as far as causing psychosis, depression, anxiety and etc. After one dr mentioning celiac I did the research and found that it could cause these things. When eating gluten you do not absorb any nutrients, hence your brain is not nourished with nutrients it needs to focus. After going on the gluten-free/ CELIAC diet, I felt completely different within a week. I even gained energy I didn't know existed. NO MIGRAINES, no seizures, and best of all NO MEDICINES anymore! It is crazy to think that digestion could cause all these things but the good thing is that there is so much available to make it easier to cope with...