The basic thing is ... don't get yourself involved with the primary buyer ... you are only dealing with the seller. Given the potentially complexity of this transaction, all the more reason for you to have a real estate attorney representing your best interests. It's always advised to have one in Massachusetts anyway.
In that case, the Buyer has no rights to the property and the Seller can accept your offer.
The only thing is the buyer getting his deposit money back since he violated the contract.