I tend to think about (read: daydream over) my latest WIP just before falling asleep. This is a bad idea, for just that reason. If I get a great idea, I have to get up and jot something down or I'll lose it by morning. And sometimes that's enough to wake me up and I'm up for hours (I have the worst sleep problems sometimes). But still, I get up and I jot.
I don't write unless I can't fall back asleep. I just type enough down to jog my memory in the morning. Maybe a bit of dialogue, a quick couple of words. Um... Here's one from a few weeks ago:
B sees R re: patrice curse, can use to hint at CU in town
R: "Ah. Your opinion. I've been looking all over for that."
Now, I can't recall the entire scene I had in my head, but it did solve a problem about when to start introducing a plot complication, and it gave me a nice, sturdy B-plot to start building on. But if I'd stayed up to write out the whole scene as I saw it, I'd have been up all night. And if I hadn't written anything down, I probably wouldn't have remembered any of it. It's a nice compromise for me.