My daughter did the same thing - she'd hold her poop all day, then let loose shortly after we put her to bed. We were sure that part of it was a comfort thing - she relaxed in bed, and that's when the poop came.
We had her sit on the potty w/ a book every night before bed with some success. We also let her choose whether to wear a pull-up or big-girl undies to bed (she's NEVER had a middle-of-the-night accident unless she's been really sick). We also talked about how poop belongs in the bathroom, and by using her bed to poop, she was turning her bed into a bathroom, and does anyone really want to sleep in the bathroom? This combination was successful about 75% of the time, but we still had occasional accidents in undies, or deliberate "I choose the pull-up 'cuz i gotta poop".
What finally turned the corner was a day where she was at her best friends' house. The kids got soaked playing in water, and she wound up borrowing undies from her friend. She didn't want to take them off at bedtime. Five minutes later, she announced loudly, "I gotta poop!" and ran into the bathroom. Success! When we asked her why, it was because she didn't want to dirty up her friend's underwear. I did laundry every day for a week so she could wear those undies at night... and she hasn't missed a poop in the potty since.