Origin uncertain. Chiefly and originally British slang. Possibly from an Indo-Aryan language: compare Hindi ठीक है, बाबू (ṭhīk hai, bābū, “it's all right, sir”). The phrase could have been picked up by British personnel in India before independence and spread in modified form to the United Kingdom and elsewhere in the Commonwealth. Alternately, it may be an extended version of that's the ticket, possibly influenced by peekaboo. Attested in English since the 1920s.