idiom
turn the tables
Meaning
to reverse a situation and gain the upper hand
Example
They were losing, but managed to **turn the tables** in the final round.