Courtney Gains -- who starred as psychotic teenage killer Malachai in "Children of the Corn" -- is allegedly wreaking havoc in his real life too ... his ex-girlfriend obtained a restraining order against the guy claiming he's threatening her life.
Kelley Marie Pospisil -- who says she dated Gains for 2 years --filed court documents begging the judge to keep the 46-year-old actor at least 100 yards away from her at all times.
In the docs ... Kelley says Gains has been sending her threatening text messages since they broke up ... writing things like "Don't think I won't go find your ass. Just keep it up b**ch."
K.M.P. says Gains is using Facebook to track her down through her friends ... and fears "his escalating behavior is going to get worse." She also claims Gains confessed to her that he was abusive towards past girlfriends.
Kelley states, "I am scared that [Gains] may be following me or stalking me ... [his] behavior is terrifying and making me fearful of my life."
We reached out to Gains for comment -- but no luck.
A hearing is set for August 21.