Assuming loan of 1st when 2nd already foreclosed and has Deed

Property is currently scheduled for Trustee Sale but bank has offered me to assume the existing loan. But the holder of the 2nd Trust Deed had already foreclosed and currently has the deed. I believe if the 1st Trust deed forecloses, then deed automatically transfers to buyer at auction or the bank if it goes REO. So the 2nd will get wiped out and they will lose the Deed. But if I assume the loan from the 1st Trust Deed then I will have to buy the deed from the 2nd that foreclosed. I am guessing this is the reason the 2nd foreclosed so they could get some money out of a situation like this because they hold the deed. Any insight, suggestions or advise on this situation would be greatly appreciated.

If you assume the loan on the 1st then you own the loan in that lien position. You could then foreclose on that position and wipe out the 2nd. They would have to pay you off in order to secure their ownership interest.
If a second forecloses on a property they do so with the knowledge that they would still be responsible for any superior liens. It could have been a mistake on their part or they did this to protect their equity interest if there is some equity above the amount owed on the first.
Make sure you do your research and verify that the loan you are assuming is a first and there was not a subordination agreement that was filed.