This used to happen to me a lot, and still does sometimes, usually in the City, so I now purposely ride further out from the kerb especially if I consider that the road is too narrow for any vehicle to pass me safely, I will force them to wait.
Some motorists seem hell bent on having to save half a second. Consider the amount of times that you and everyone else have been overtaken only for the motorist to then immediately turn left in front of you.
I am seriously considering the purchase of a CCTV camera to fit onto a helmet.
Has anyone else tried this idea yet?