"Battleworn" posted the following powerful Chizuk on the forum from a Shmooze by R' Tzvi Meir Zilberberg - Shvi'ee Shel Pesach 5759 (edited for clarity):
The Chozeh from Lublin, The Beer Mayim Chaim, R' Hershele of Ziditshov, R' Tzadok Hacohen and other tzadikim all said:
When a person feels "I blew it already, I messed up this time", and yet he still doesn't give up and keeps trying to salvage what he could - ignoring the fact that he already failed (R' Tvi Meir calls it "Kum B'palgus Laila - getting up in middle of the night" in the words of the Zohar Hakadosh), then the Nachas Ruach that he makes for Hashem is even greater than when one is completely successful. And this is the epitome of Shechina Ba'tochtonim (bringing the divine presnece into the lower world) which we know is the purpose of creation.
This type of Avodah is the greatest form of mesirus nefesh, because it is completely against human nature, as there is no short term satisfaction.
The yesod is hinted to in parshas Vayishlach. The Pasuk says "Vayei'avek ish emo ad alos hashachar - and the Malach faught with him until the morning broke". Chazal say that the Lashon of "Vayei'avek" comes to teach us that "He'elu avak ad kisei hakavod - they lifted dust until the Throne of Glory". R' Tzvi Meir explains that through the struggle that Yaakov Avinu had with the "other side", he uplifted the lowest situations - the dust of the earth - all the way to the Kisei Hakavod ! [As a matter of fact, we don't find any hint in the pasuk that Yaakov overpowered the malach. On the contrary, the malach actually wounded him. But because Yaakov wouldn't give up even after he was wounded, the "other side" was forced to "agree" to bless him. This is to show us (Maseh Avos Siman La'banim) that the tikun hashalem will ultimately come through our not giving up].
Perhaps the greatest illustration of this, is by Yoseph Hatzadik, in this weeks Parsha. The gemoroh (in sotah 36b) says, that Yoseph actually came in to Potifar's house to sin (as Rashi brings). And the Gemoroh says that he actually spilled seed at the time, thereby losing Ten Shevatim that were supposed to come from him. Yet, when after all that, he still held back from sinning, he became the great Yosef Hatzadik (the Merkava for Midas Hayesod and one of the seven "Roiyim"!).
R' Tzadok and other tzadikim explain that this is what really constituted the nisoyon. The menuval said to Yoseph: Don't you see that you already messed everything up? And don't you realize what a goner you are? Your brothers the Shevatim, already paskened that you are chayav misa, and they even included the Shechina Hakidosha in their Beis Din. (Even Yitzchak Avinu who knew where Yoseph is, didn't tell because Hashem had been included in the Shvuah not to reveal it to Yaakov). Nobody cares about you any more. You're lost and cut off from this world and the next. And now you failed so badly. Face the facts, it's over!
But Yoseph Hatzadik said "No! I don't care about anything - not even about being a tzadik. The only thing that concerns me is: What do I need to do at this moment? What does our father in heaven want from me right now?
And it was in that zechus that he was zocheh to everything. That is why he is called Yosef Hatzaddik. And even Krias yam suf was in his zechus, as Chazal say "Hayam raah vayonos - ma raah? arono shel Yoseph! - The sea saw and fled. What did it see? The coffin of Yosef". When the sea saw before it a human being that had completely defied his nature for the will of the Almighty, the sea defied its own nature for the Almighty too, and split.