the locked key occurs when the car loses power, it's a built in safety feature in the car.
As for the main issue with cutting out power, i have a few questions, and a couple things to check for:
Q1: what is the weather condition like when the problems have occurred?
Q2: When the car does work, what is the DIC saying about battery voltage?
Q3: When the car does die, it's only for a short period of time? How long of a time?
Possible cause 1: it could be a short at the battery, check both your positive terminals to make sure they are tight, and check that your ground wire has a proper chassis ground, just follow it, and make sure it's properly connected.
Possible cause 2: check the powered terminal under the hood, make sure it's tightly connected, and that wire isnt grounding anywhere it shouldnt(thus causing a short).
Possible cause 3: check all the wiring for anything you have added, making sure you didnt jump into a vital circuit for the car with your system. A bad connection, or a faulty ground from an aftermarket installed system may cause that issue, and overloading a circuit will do it too.