Deductions & credits

"decreased in value" compared to what?  Compared to your basis (figured as I described?)  Compared to the original purchase price, or compared to some intermediate value?

It's perfectly possible to have a large taxable gain and get no money out.  Suppose a house is bought for $100,000, refinanced for $200,000, and sold for $150,000.  The seller gets little or no money, but they still have a capital gain of $50,000 (selling price minus purchase price) and owe tax on that. They can owe tax, even though they got no cash out, because they effectively got the cash out at time of refinance.  If they hadn't refinanced earlier, they would now get $50,000 cash out.  Since they took the cash earlier, they don't get it now, and they still have a taxable gain.

Just because the house lost value from the refinance in 2009 doesn't mean it lost value from it's basis.  You have to figure the basis as I described.