Get the upper hand (on someone)

To get into a position superior to someone.

I got the upper hand during my dispute with the apartment manager.