This is related to the question about "dieses Jahr, diesen Sommer", with the difference that you are asking for an indefinite time.
As Em1 already mentioned, it is an adverbial expression. You ask for such an expression using when (wann):
Wann fand Peter die Schatzkarte?
You want to answer:
But you answer with an indefinite time expression without a preposition. Then you have to use genitive (scroll down to "4) Expressions of indefinite time"). Genitive of "ein Tag" is:
Maybe the link in Em1 answer for the Adverbialgenitiv now gets clearer.
You also can use the preposition an when answering the question, like knut pointed out. Then you would need dative:
An einem Tag (fand Peter die Schatzkiste).