That's the card. The right thing; the ticket. The reference is to tickets of admission, cards of the races, and programmes.
“10s. is about the card.” —Mayhew: London Labour, etc.
A queer card. An eccentric person, “indifferent honest.” A difficult lead in cards to play to. A knowing card. A sharp fellow, next door to a sharper. The allusion is to card-sharpers and their tricks.
“Whose great aim it was to be considered a knowing card.” —Dickens: Sketches, etc.
A great card. A big wig; the boss of the season; a person of note. A big card. A leading card. A star actor. A person leads from his strongest suit.
“A loose card is a card of no value, and, consequently, the properest to throw away.” —Hoyle: Games, etc.
A sure card. A person one can fully depend on; a person sure to command success. A project to be certainly depended on. As a winning card in one's hand.
“Law ... is the card to guide the world by.” —Hooker: Ecc. Pol., part ii. sec. 5.
“We must speak by the card, or equivocation will undo us.”— Shakespeare: Hamlet, v. 1.
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894
More on Card from Infoplease: