heh, I had the same thing happen with a few of my dreams, good sci-fi stuff, but I suck as a writer, so never really worked it out. Still have the sheets with the notes on it though..
What you described is a known way of dreaming, for the life of me I can't remember the name, but it is as you describe it, just barely conscious enough to realise you're dreaming and "steering" your own dreams. It's quite fun and I believe entirely harmless.
edit: gotta love Google. It's called lucid dreams or lucid dreaming
edit-edit:
http://www.xs4all.nl/~pasquale/TTM/
http://www.lucidity.com
all the info you could want about it
