I suspect the owners didn't know their pay off and the listing agent didn't research the home. The truth is, if the sellers can't write a check to perform, then I don't know that you could take them to court and compel them. Since the property has now become a short sale, will the $40k make up the difference or will the payoff still be short?
List price in a short sale is meaningless. Until the bank approves a price, you have no contract. Where this one started out as conventional, someone really blew it.
How do you want to proceed? If you walk away this should be easy to avoid. Public records indicate what was borrowed on a home (at least in my state) when they purchased it and any subsequent refinances too. A Title search should be ordered by the listing agent when the property first hits the market to determine if there are any issues that may get in the way. On a new home, review the public records your agent can provide and request a copy of the preliminary Title Policy with your offer to make sure your next one goes smoothly.