Rumplestiltzken offers the "Deal of a Lifetime" to anyone who turns Shrek in, so Shrek turns himself in and wishes for all the captured ogres to be set free. Rumplestilzken locks Shrek up with Fiona. The loophole being that since Shrek was never born, Fiona's curse was never broken and she will become human at sunrise, so she is technically is not an ogre. Donkey and all the other ogres storm the castle and Shrek and Fiona escape. Rumplestiltzken is defeated, but it's too late - Shrek's day is up, so he starts to disappear. Fiona kisses him, which breaks the spell (True Love's Kiss, remember?). Shrek wakes up earlier in the film at his kids' birthday and they all live happily ever after.