Your question works so well with the beginning of the very last chapter of this wonderful novel:
But the question you want answered, I know, is did they live happily ever after?
Yes ... and no.
That is the exact (albeit general) answer. However, now allow me to give you a few more specifics about the main characters. To make it as simple as possible, I'll use a 1-10 happiness scale (with 1 being despair and 10 being bliss):
ROSCURO (7 on the Happiness Scale): All Roscuro ever wanted was light. He achieves light at the end of the story, ... with a twist. "He was allowed to go back and forth from the darkness to the light. But, alas, he never really belonged in either place." He also gets an extra "happy point" for managing "to shed some small light, some happiness into another life." Roscuro tells the princess about the prisoner and allows that prisoner to be united with his daughter: Miggery Sow.
MIGGERY SOW (7 on the Happiness Scale): All she ever wanted was to be a princess (and eventually, all she ever wanted was her "Ma"). Mig never gets either of those things. However, she does get her dad who "treated her like [a princess] for the rest of his days."
PRINCESS PEA (7 on the Happiness Scale): Due to the loss of her mom, the queen, Princess Pea cannot be put above a 7. (The princess, of course, has all of her mental capacity, unlike poor Mig.) She does, however, gain a wonderful friend: Despereaux.
DESPEREAUX (7 on the Happiness Scale): Due to the fact that Despereaux is and always will be in love with Princess Pea, but cannot marry her, he can't achieve more than a 7 on the Happiness Scale. "Even in a world as strange as this one, a mouse and a princess cannot marry. But, reader, they can be friends. And they were. Together, they had many adventures."
I truly adore the complexities of your question. Why? It allows you, the reader, to truly think critically about the characters and ascertain exactly how happy they become. "Did they live happily ever after? Yes ... and no." That translates to a 7 on the scale for all of them. You see, "happily ever after" implies living in bliss: a perfect 10. None of our main characters live in bliss. Does anyone?