I'm not a lawyer, so this isn't legal advice. For that, you need a lawyer.
First, the $5,000 was probably an option fee, not a deposit. In other words, you spent $5,000 for the right to buy the property (with it being credited to the purchase price if you decided to). It was not a down payment. Big difference.
The option itself becomes worthless upon the foreclosure.
You do raise an interesting question from a legal standpoint. Since you didn't receive what you paid for (the right to buy the house in return for the $5,000), the owners didn't comply with their end of the deal. And perhaps--legally--you might be entitled to it back. Again, a lawyer can advise you on that.
However, as a practical matter, you're unlikely to be able to recover it. Frankly, the owners probably don't have the money to give to you. A lawyer can help you with that, and advise you on whether it'd make sense (probably it wouldn't) to pursue the owners in court for something like breach of contract.
Henry, here is a link to your current competition homes (for sale) and pending homes (under contract waiting to close)
To find out what your home would bring in today's market, tips on what to do and what not to do in order to sell for TOP DOLLAR and a more accurate home value, click on the link below and fill out the form.
I hope this helps.
Search ALL THE HOMES FOR SALE IN PHOENIX ARIZONA HERE (Live Data Feed):