I have a similar problem with my driver's side door lock. It doesn't work when I use the lock/unlock switch or the keyless remote, and it also doesn't lock/unlock when I turn the car on or off. It works maybe once out of every 10-15 attempts to lock/unlock it and every once in a while I can see it twitch a little.
I took the interior door panel off thinking it might be a loose cable going from the latch to the door lock but everything there seemed ok. Because the lock twitches occasionally, I'm starting to think that the lock/latch is going bad and that it is not a loose electrical connection, but I haven't checked that yet.