My car had similar problems, it stalled sometimes during idle and then I went to start it and wouldnt crank over, and sometimes when im driving it loses power and the car is trying to cutt off and then when I get to traffic light it stalls, and I had to press lock and unlock again before I could crank, not sure if same problem as you but I had one of these in the glovebox.
Took that out and problem is gone. Hopefully this helps but sorry if it doesnt, hope you find the solution soon mate