I get lots of ideas when the lights go out at night and it gets very quiet. Sometimes they come when I first lie down to sleep; other times I wake up with an idea racing through my mind. But regardless of when an idea comes, I have made it a habit to get out of bed and write the idea down before it disappears into my dreams. You should do the same.