You were dreaming. When you become afraid like that, it often turns into a nightmare. Sounds like a pretty cool experience.