It's simple, when you workout, in your case doign crunches, you tear the muscles. But right after you do them, and for the rest of the night, soreness doesn't set in cause your steadily using your muscles, and they stay warm. But when you got to bed, they rest and get cold. When they're idle (obviously used a little bit, but not to the same extent as during the day) for hours at a time, they'll be sore, because they have been torn, and are rebuilding. That's what working out does to you, and they'll be especially sore if it was the first time you worked out in a while, since they're not used to the punishment.. does that clear things up?
Also, I highly doubt your abs improved over night. It takes time for muscles to get bigger/stronger. They might just have looked better due to less food in your stomach, less water etc. Things like that that make you look more cut up.