Think of a situation where you gained the upper hand in the past. What happened, how did you do it? How did you feel? Gaining the upper hand does not mean winning, it means tipping the balance in your favor so that winning becomes possible.
Let me know if you appreciate this idiom. Requests are welcome.