Turn the tables on (someone)

To reverse the situation for someone.

The opposing team was able to turn the tables and win the game.