3 answers
(click or scroll down)
I believe it acts as an adjective describing the word "time." If the structure of the sentence is changed to:
Long ago, there lived a princess.
I think then it would be an adverb describing "lived."
I would wait for further confirmation on that from someone else, but that's my initial thought.