Even if we started to slip, we can achieve the greatest levels of Kedusha by stopping ourselves from sliding further. The Sefarim write that the Nachas Ruach we give to Hashem by holding back even when we feel that “we already blew it”, is even greater than when we successfully avoid the tests in the first place.
Perhaps the greatest illustration of this is Yosef Hatzadik. The Gemara (Sotah 36b) says that Yosef actually came to Potifar's house to sin (as Rashi brings). And the Gemara goes on to say that he actually spilled some seed at the time, thereby losing ten Shevatim that were supposed to come from him. And when after all that, he still held back from sinning, he became the great Yosef Hatzadik!
R' Tzadok explains that this is what really constituted the great test. The Satan said to Yosef: “Don't you see that you already messed everything up? Don't you realize what a goner you are? Your brothers hate you and sold you to Mitzrayim, nobody cares about you anymore. You're lost and cut off from this world and the next. And now you’ve failed so badly. Face the facts, it's over!”
But Yosef 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 very moment? What does my Father in Heaven want from me right now?” And it was in that zechus that he merited everything. And Chazal say that even the splitting of the Yam Suf was in Yosef’s merit!
So, if we want to split our own personal Yam Suf, this is one of the greatest Yesodos to keep in mind!