The phrase is an irony allegorical to Nora's finally finding herself and radically maturing from being an object of entertainment to an object of self-admiration. Her insistence in "the miracle" came as a result of her former, immature, self which was completely co-dependent in life, in her husband, in fantasies. Yet, she did have a miracle happen to her: She broke free, and this may have been what is NOW, in Nora's life, "the most wonderful thing of all".
Of course, in Torvald's mouth those words change radically: Now he wonders how in the world he let HIS most wonderful thing of all go away due to his own ridiculous behavior. Now he wonders where his life will go. Nora has the same problem, but now she is in charge of herself.
I think this is a great question, especially since the play, whichever version one reads, is a translation. And there are many translations of this play out there. For example, my translation, which is by Rolf Fjelde, gives Torvald's final line as:
Nora! Nora! Empty. She's gone. The greatest miracle -- ?
Whichever phrases is used "the most wonderful thing of all" or "the greatest miracle," a key observation about this line, in ascribing meaning to it, is that he is repeating part of a previous line of Nora's, part of an exchange that comes just previous to this final line:
Nora -- can I never be more than a stranger to you?
Ah. Torvald -- it would take the greatest miracle of all --
Tell me the greatest miracle!
You and I both would have to transform ourselves tothe point that -- Oh, Torvald, I've stopped believing in miracle.
But I'll believe. Tell me! Transform ourselves to the point that --?
That our living together could be a true marriage.
So, it is, first, of importance that he is repeating a phrase, an idea that was introduced by Nora, almost as if it were a foreign language that he cannot understand...yet. It is also significant that he is quite focused on this idea, since the last image that the audience has of the play is not of Nora leaving, but of Torvald considering this idea. This final image suggests to me that his consideration of this idea is, potentially, as important a transformation in the play's as the one that Nora has already undergone.
The second thing that I notice about my translation of this phrase is that it ends in a dash (which, in a dramatic text, signifies that the speaker is interrupted, either by their own thoughts or by another speaker) and a question mark. So, this suggests to me that he stops himself from going past these few words in summarizing what Nora has said must happen for them to get back together, because he does not yet understand what it means (hence, the question mark).
So, Ibsen has very pointedly left Torvald alone onstage to have the final moment of the play, rather than Nora, suggesting that the next step, after Act Three is over, is in his hands and that he is fixated upon living up to this "most wonderful thing of all," if he can figure out how.