I have this scenario happen all the time in my 330xi. The behavior is somewhat random. My wife typically leaves her key in her purse - on the passenger seat. Usually - but not always - it obeys the key on the *outside* of the driver's door even if the key on the seat was the last used. If it doesn't work as expected you can usually lock then unlock the car and get it to load the correct memory key
Does anybody know what happens if you wash your car with the car in your pocket?