It's a combonation of at least two factors.
The number 1 factor in any head on collision is ping. If he's so much as 5 under your own on average, odds are he will beat you to the punch. The bigger the seperation of pings, the more likely it is for the lower ping to hit.
The number 2 factor is when you hit the button alongside where you are aiming. You can hit someone from a piece that sticks out of their hitbox to their left without too much risk to yourself most of the time, as they will usually be aiming at you, and they'll reach that invisible appendage first. Other times, if you happen to hit the melee button at just the right moment you'll beat your opponent almost regardless of his or her ping.
These things should be corrected by beta 1.2