How many days are you into your contract and have you signed off on your contingency yet. There are several steps to the escrow period. As long as you are still in the 17 day contingency period you are good although it is posible if the seller is a bank it was reduced to 10 days. If the house has an HOA have you gotten a copy of the CC&R's yet at which time you can also back out and keep your deposit maybe minus some charges.
How was the contract written? Was there anything in the mortgage contingency about the house appraising out? Check and see. If so, then you should be able to cancel the contract and be entitled to your earnest money back. Check with your attorney to be sure.