I'm sorry I don't really have any idea what this was about. I'm afraid it's just one of those enigmatic experiences one can have for which there's no explanation. Perhaps it had something to do with the amount of sleep you were getting, or something to do with how well you were or were not eating, or what stressful things might have been going on in your life at the time.
The important thing here, from my perspective, is you not become so scared of the possibility of this reoccurring that you actually cause something similar to happen. So when thoughts regarding the experience you had come up, it's important to be able to allow them to arise & fade at their own pace without becoming "hooked" into them, so to speak. When these thoughts come up you can breathe into them, smile to them, perhaps even place a hand over your heart as a sign of compassion for them (as well as for yourself), & then simply let them go. This is a Buddhist practice called "compassionate abiding". However here's a link to a mental-health-oriented description of the practice:
Relieve Distress By Allowing It: Compassionate Abiding 101 | Mindset: Perspective Is Everything
May it be of benefit.