If you did not get your loan with in the contingency period. The seller has every right to keep your deposit. It is written into the standard contract.
Your best bet is to plead with the seller and or have your agent plead on your behalf. In this market, they may already have another buyer ready to go into escrow. In that case they may be willing to release your funds to you just to move on.
That said, the importance of having your loan and funds in place prior to starting to search for a property cannot be stressed enough.
Please speak to a qualified loan officer. Ask them how many purchases they have completed? Also, when did they complete the transactions? Today is a much different market than it was two years ago...and so on...
Because some loan officers are familiar with refinancing, but have no clue how a purchase works. They should ask you for loan conditions [pay stub's, W2's, bank statements, etc...] prior giving you a loan approval letter.
If you don't have a loan officer to work with. Any Realtor you are working should have several on their contact list.