Turn the tables

Meaning: To change a situation so that you gain an advantage over someone who previously had the advantage.

Example: The underdog turned the tables in the second half.