Deductions & credits

The suspended loss is fully released when you sell the property in a fully taxable transaction.  So you get that $20,000 deduction no matter what.  It has no effect on the gain/loss calculation; it is a separate deduction and shows up on Schedule E.