To turn the tables / To reverse the situation
Literally 'to flip the omelette'. Describes completely reversing a situation so that the disadvantaged party ends up on top.
They were losing 3-0 and managed to turn the tables.
With that move he turned the tables in the negotiation.
—How did it end? —She turned the tables at the last moment.