I did that with one of our vehicles several years ago. I went out to start it up one morning and shut the door. It would have been okay, but I forgot to unlock the door. The door automatically locked upon starting the engine.
I was in Virginia at my Mom's house and had to borrow her car, drive to Tennessee where hubby was working and get his keys. I then had to drive back and unlock my car and then drive back home to Tennessee. LOL!!