To backfire / To go badly wrong
Literally 'for the shot to exit through the butt of the gun'. Describes a plan or action that produces the opposite of the intended effect.
He tried to surprise her and it backfired on him.
Her strategy backfired on her.
—How did the plan go? —Terribly, it backfired on us.