For me, this often happens when I'm in the shower. Five years ago I set up various capture devices throughout my offices & home, including -- you guessed it -- the bathroom.

Despite my introductory statement, I did not stop having good ideas now that I had the means to record them. I DID find that I no longer lost the ideas. I don't want to give the impression that I intentionally use my bathroom/shower as my brainstorming center, however it sure is nice to be able to capture the ideas at the point of thought.
I can now say that many of my best ideas have come -- and been captured or elaborated upon -- while shaving or in the shower.