The Scottish Guardian. January to June 1872.
Dictionary of Phrase and Fable, 1895
Words, facts, and phrases; a dictionary of curious, quaint, and … 1882
Apparently, there is rampant debate as early as the 1880s about the origin of the expression “That’s the ticket.” In use, according to research, since at least the 1820s, it is meant to describe “the very thing” or “the right thing” or “proper course of action”, and so regardless of the etymology still means the same it does today (although I rarely hear it used, unless we are watching 80s reruns of SNL).
I found a cockney like reference to it in 1839 (The clockmaker: or, The sayings and doings of Sam Slick) and 1830 (Faith and Falsehood Or, The Fate a Bushranger: A Drama in Three Acts) but no entries in most of my cant dictionaries from the era, so my guess would be this wasn’t a popular expression until the Victorian era.
There is a little more discussion here: http://www.word-detective.com/2009/11/thats-the-ticket/