Assuming that the loans are still in the same order that you describe, if the third mortgage holder foreclosed, they will take the property subject to the first two mortgages. The best thing to do is to work with the third noteholder to try to work out an extension. If the payments you have been making are substantial, it likely that the bank would rather have a continued stream of payments than the property back on their books. They may be willing to work with you, but communication is the key.
The fact that the third noteholder - presuming, of course, they are indeed recorded on your title behind the first two - gives you some leverage in that they can't simply foreclose on you and take your home...they would have to deal with the first two lenders, too. That reality may be enough to get them to work with you on a payment plan rather than to go ahead with a foreclosure case. It will be a good idea to consult with a local attorney who can review your entire situation and adivise you on the best way to go.