“Tama won’t take her medicine!”
“Don’t worry. I have an ace up my sleeve.”
“Cheese? What will you do with that?”
“Hide the pill inside. She loves cheese!”

An ace up your sleeve is a last-resort solution that is sure to work. It comes from cheating at card games. An ace is a strong card, so when you are losing the game, you sneak the ace out of your sleeve and use it.