H. G. Wells, 'The Door in the Wall', from 19111911 may be a good contender.
It's probably a slightly different variant, since it's left questionable if the story is about an IMAGINARYimaginary door or a real one.., but it's still a door to another world. From right near the end:
I do not know. I have told his story as he told it to me. There are times when I believe that Wallace was no more than the victim of the coincidence between a rare but not unprecedented type of hallucination and a careless trap, but that indeed is not my profoundest belief. You may think me superstitious if you will, and foolish; but, indeed, I am more than half convinced that he had in truth, an abnormal gift, and a sense, something--I know not what--that in the guise of wall and door offered him an outlet, a secret and peculiar passage of escape into another and altogether more beautiful world.
Since I believe it's well past Copyright, you can read it online here.