i started to have the same problem before going to sleep at the same time when i started working in an office setting... i thought i was having heart attack, stroke, panic attack, migraine, you name it... and i don't have ptsd that i know of
at first it was so bad, i went to emergency where they did cat scan of my brain, checked my heart and asked questions about exposure to radiation and so on... eventually they found no problems and the doctor told me that i don't want to be put on antidepressants cause they kill your liver... i thanked her and then another doctor told me to take it easy, start eating healthy and get some good multivitamin
it took me a while to learn how to eat healthy and find a good multivitamin... both suggestions helped but what really gave me a health boost is drinking filtered water only vs tap... i learned about fluoride in the tap being poison and got myself a few filters... i'm not affiliated with any manufacturer, just trying to help people in need: the filter that helps me the most is zerowater, you can get it in retail stores and it's not that expensive... ever since i started drinking filtered water only, i would still get a jolts but the terror would be no more... just a jolt before going to sleep, then heart racing for a few seconds and then a state of peace and harmony after which i sleep like a baby
years passed since then and i truly learned a lot about this condition... i still have it every now and then and after some research came to a conclusion that in my case it is completely normal and happens only in certain scenarios... again, i don't have terrors any more when it happens nowadays
what i learned is this is a pure life preservation mechanism of your body without which you're likely to not wake up... if you experience this, you should be thankful unless you'd rather be dead... from my observation such signal is sent when brain doesn't get enough oxygen, with not enough oxygen brain damage occurs...
i'm a perfectly healthy individual, however i still experience this and here's why... because i still work in an office setting, my body muscles are compressed most of the time during the day, meaning that my legs, arms, back and neck are not relaxed... this is bad for your veins and arteries because those are compressed also and a normal blood circulation is not possible... but when you go to sleep everything changes, muscles relax and your blood is released to flow freely... this is the whole different mode for your body to operate, and your oxygen levels need to be readjusted in order to operate in this other mode
that's what your body does, it jolts in order to wake you up to promote breathing and your heart would race to supply more oxygen filled blood to your brain... i currently try to do 3 things to avoid jolts: keep my arms and legs stretched vs bent in an elbow, knee; jog or walk just before i go to bed; lift some weights cause it seems to improve your arteries
i hope it helps