I've had this happen to me at many bars, and have done it on a couple of occassions myself during my tending career.
Sometimes the patron is right, sometimes the bartender is right.
It's very rarely intentional (a bartender that does this often will not keep their job), and is usually worked out by the attitude each party displays.
The easiest way to handle it as a patron is to politely ask the bartender to check the till to see if a $20 bill is in the $10 slot. If it is, you'll likely get an apology, your money back and maybe a free drink. If it's not, say "that's cool, I'm not perfect either - have a good one" and walk away. It's $10 and not worth fighting over. As was pointed out earlier, if that was done and the person comes back to me later in the night, then I'd usually give them a free drink or a greatly reduced drink because it tells me that the patron wasn't trying to pull a fast on on me, which happens much more than you think and probably prompted the reaction this guy got.