Had the same happen with a brand new Mini once. Brought it home from the Dealer and couldn't lock the doors. Eventually cleared itself. However later on in the evening went out to check the car and found all the windows and sun roof had opened spontaneously in pouring rain! Called out BMW recovery who towed car to Dealer where it stayed for a week - fault eventually found to be a loose connection on one of the rear lights. Dealer said, that as everything is linked through the wiring loom, the on board computer had misread the fault.
Didn't keep the car long as had no confidence that fault would not re-occur.