The reason the glass slipper in Cinderella didn't turn back to a regular slipper (or disappear) at midnight is because the Fairy Godmother was messing with us: her main goal was to set Cinderella up for life, and to do that she needed a way for the Prince to find her. She could easily have magicked Cinderella into the life she wanted, arbitrary midnight deadline be damned, but instead the Fairy Godmother decided to make the Prince want her for her own qualities and to prove his love by tracking Cinderella down.
It's like the theory in Aladdin that it's all in pursuit of his first wish — that is, to make Aladdin a prince. He doesn't become a Prince until he marries Jasmine and the Sultan changes the rules; until then, he only appears to be a Prince. Until that point, the Genie is acting in pursuit of a larger goal.
Magic users are tricksy.