The ethical issues involved in your situation include violation of full disclosure, unfair practices, and breech of contract. Sam Salesperson failed to disclose to the seller that you requested an extension of the earnest money payment, and did not tell you this. Sam Salesperson intentionally let time lapse to void your contract in order to accept a higher offer. There are several causes of action in your case.
You may bring action against the seller and Sam Salesperson based on a breach of contract. Because you had an agreement with the seller. There was a lack of communication between the salesperson and seller. There are grounds for fraud here based on Sam Salesperson not intending to let the timeline for the earnest payment lapse. You also have grounds for negligent misrepresentation based on a breach of fiduciary duty to you. You may request that the judge rescind the purchase contract as you had a contract with salesperson and seller before the higher offer was discovered.
You had a contract agreement with the seller to purchase real estate which was breached when the seller accepted the higher offer. You also had a contract with the salesperson which was breached when you failed to pay the earnest money by the deadline. Even though Sam salesperson failed to notify the seller of your request for extension you are the one who breached the contract since there was never a stipulation extending the time for you to pay.
"A contract is created at law when there is a mutual exchange of promises upon reasonably understandable terms and conditions. A contract does not have to be reduced to writing in order to be enforceable" (asu) http://www.asu.edu/counsel/brief/contractbasics.html
Remedies:
You may request damages which would be measured by the