I'm not sure exactly maybe someone else could chime in.
You don't think you accidentally hit CMD+tab ? This works like Alt+Tab in Windows for quick switching apps.
Hitting it once will switch to the last app you had open.
No, as I said I was only working on the spacebar, although I did manage to type a couple of characters in the app I switched into. So I guess anything is possible.
Also, the app i switched into was in the same space as the Finder.
If no one here comes up with a solution, then I'll just assume I must have somehow hit Command-Tab.