Is there a metaphor or a single word for "When you throw a rubber ball into a wall and it bounces back and hits you." Something like boomerang, but unexpected and with negative connotation.
backfire: a miscalculation that recoils on its maker
backlash: a strong negative reaction, as to some social or political change
kickback: a sharp violent reaction
payback: a bad or unpleasant thing that someone does to you after you've done something bad or unpleasant to them. E.g. payback on French Nazi collaborators after WW2.
One word that could work is blowback.
Definition of BLOWBACK
: an unforeseen and unwanted effect, result, or set of repercussions
When Geoffrey slandered his ex's new boyfriend on Facebook, the equally negative remarks from his ex's friends came back to bite him.
Hoist with his own petard
... is —as far as I can see— a Shakespearian phrase for a plan going so wrong that it is inflicted back on the perpetrator. Literally to be blown up/over/away by a small bomb used for breaching that you set.
It does really only work within the context of a plan or some other pre-meditated plan. An accident doesn't quite cater to this enough. It really benefits from showing some malevolence and forethought:
Desperate to knock the cawing crow down from his fence, Albert picked up a stone and took careful aim. He took a second to imagine of the lie-in he would enjoy the next morning, devoid of this twittering bag of feathers. Time slowed as Albert unfurled. Seeing the shot leave his hand, he would have bet his grandma on hitting the bird but as he was carried around by the momentum of such a colossal throw, the flight-path drooped. The stone hit the fence and, hoisting Albert upon his own petard, cracked him in the side of the head.