Turn the tables
Reverse the positions of adversaries. The phrases is often used when the weaker position subsequently becomes dominant.
Games like backgammon are known as 'tables' games. The phrase 'turn the tables' derives from these games and from the practise of reversing the board so that players play from their opponent's previous position.
The first known example of the figurative use of the phrase in print is in Robert Sanderson's XII sermons, 1634:
"Whosoever thou art that dost another wrong, do but turn the tables: imagine thy neighbour were now playing thy game, and thou his."
See also: vice-versa.