With unusual and intermittent problems like this there's always the additional problem with hypotheses and a misapplication of cause/effect.
This same sort of thing has happened to my car several times with the rear glass hatch not wanting to lock. No matter how I try it won't lock and there is no way of predicting when it will happen. Strangely, as has been described with the door lock in this thread, after walking away and leaving it for awhile it magically decides to lock. If I crossed my fingers when it decided to lock the conclusion would be that the solution is to cross the fingers.

Dealer solution was to replace the latch as described in this thread -
Rear Window Latch Problem or the lock and cable as reported by another poster. Of course after doing anything it would be working properly just as doing nothing lets it work after a short period of time. But there was also the suggestion that it is the micro switch that is faulty, and of course the usual other suggestions such as being weather related, or an air-tight cabin.
This is just another of the electrical gremlins that plague the smart car. The electrical switch is obviously at fault. Electrical problems happen with the ABS brakes and hill hold feature, gearshift issues, door locks and I don't know what else. Things go wrong then correct themselves for unknown reasons.
Some of the solutions that have been described may actually have no effect but when the system desides to work for reasons unknown then the proximity of correction attempt and the part working leads people to believe they have found the solution. That may or may not be true. Replacing the latch mechanism may not even be the solution - time and experience will tell.
Perhaps the factory knows the issues and has TSB's to solve the problems but, with the secretive attitude of MB dealerships and factory, owners are not included in the circle of information. These threads alert owners to problems and may actually lead to solutions so this is good.
For my money I think it best to go for this as the cause and solution -
Evilution - Smart Car EncyclopaediaEvilution - Smart Car Encyclopaedia