I've had a few such moments.
Minecraft is full of little moments like that.
In fact just recently, i went through the nether trying to find the right portal to get to Spawn Temple from my base.
I clearly went the totally opposite direction, because when i emerged from the portal i was in an unlit cave. Did a little exploring, found diamond, coal, gold, iron and redstone. Found my way to the surface. It turned out the cave was under a vast ocean. juuuuust made it to the surface without dying from drowning. There was a mountain in view so i swam to it. I was fairly sure i wouldn't survive the swim back down to the cave.
Made it to what i thought was a mountain island, turned out to be an outcropping overlooking valleys of stone.
Stupidly i had neither compass nor a map, and night was rapidly approaching, so i dug a hole in the side of the mountain to wait out the night.
As morning rose it became apparent that there were a dozen creepers outside. Yay.
I dealt with them and thought i would trudge in-land to see if anything was familiar. I wandered until night was falling but all i found was empty fields and a savanna. Harvested some of the new acacia trees to make torches and such, since it seemed i would be here a while. At least, here until i could get the materials to make a compass and find my way home.
In my little hole in the side of the mountain, waiting out the night, i decided to make a boat and try crossing the ocean to find home. I was fairly sure i knew which way was home based on the position of the sun.
So the next morning i set off in my new boat, with a supply of boats just in case.
That is possibly the largest ocean i have ever seen in minecraft. I traveled for a good 15 minutes in one direction without ever seeing land. I gave up on that idea and turned back. Eventually i hit land again near the mountain.
I figured heading in-land was gong to be my only hope but i decided to try a different direction.
20 minutes, many nights, and dozens of monsters killed later i saw some cobblestone: Civilization!
Best feeling ever!
Turned out to be a far out-lying road with no rails yet. followed it a while, found my way home.
Phew!