1919: The earliest usage I've come across is in "The Runaway Skyscraper" by Murray Leinster, originally published in Argosy and Railroad Man's Magazine, February 22, 1919, republished in Amazing Stories, June 1926.
Arthur was still pursuing his investigation when a sob from Estelle made him stop and look at her.
"Oh, what are we going to do?" she asked tearfully. "What are we going to do? Where are we?"
"You mean, when are we," Arthur corrected with a grim smile.
So it's being expressed with a gallows humour, but still an element of humour.
Just for fun, I did find that the International Code of Signals from 1909 lists "CQX = When are we?" so it's possible that some captain in the 19th century had to deal with this question too. :)