Buying a 2nd at Auction with Equity

Hi - I am a subscriber… I have a question related to the above thread. Let’s say I buy the 2nd at auction b/c there is equity in the property after the 1st. I know I can make the 1st whole or let them foreclose, etc. What happens if there was a 3rd on the property that did not foreclose? Would there be a windfall if the 1st forecloses or if I flip the property and there is surplus? What happens to the creditors that are Jr. to the 2nd after the 2nd forecloses if there is surplus after the sale?

To further refine my question, what happens after the 2nd mortgage goes to trustee sale? Do those Jr. to the 2nd get wiped out leaving them with no claims upon the property? I saw a recent scenario where a 2nd went for auction with no bids and went back to the beneficiary. Then the very next business day, the 1st went to auction and bidding went way beyond the amounts owed on the 1st + 2nd. There was a 3rd also on the home. I am trying to figure out who got the surplus. I am located in California.

Another follow-up. Can the 3rd sue for the windfall?

Junior loans are wiped out at the time the senior loan forecloses. They would have a claim to any excess proceeds from the sale that wiped them out, but not from subsequent sales. Thus in your scenario above the foreclosure on the 2nd with no excess wiped the 3rd our – since there were no higher bids, the lender on the 2nd is now the owner of the home subject to the 1st. When the 1st forecloses it wipes out the 2nds ownership (no longer loan) interest in the property, but as the owner they would be entitled to ALL the proceeds.