The losses that were sustained in earlier years were used to reduce other income because of the special passive activity loss rules for residential rental property. If you had any losses that were carried over because they were unallowed due to limitations, that carryover of unallowed losses would be used in the year of disposition or sale.
The depreciation expense is allowed or allowable, therefore in any year where there was periods when you didn't have a tenant, and the rental income was low, then you were still taking advantage of the expense. As mentioned earlier, it was reducing other income on the return and therefore reducing your tax liability in those earlier years.
The one year when you did live in the home there should have been no depreciation that year. You will have to review the return for that year to see what actually took place. If you find you didn't use depreciation for that year you can easily change the "prior accumulated depreciation" figure by reducing it for only that year.
Example of depreciation calculation: For a nine year period of depreciation, the combined total percentage of 32.724% would have been used (simply by adding the annual percentage for 9 years). You can click on the chart attached to enlarge and view.
A gain would seem very reasonable depending on sales price and the remaining cost basis in the property. There is good news which is that this property, because it was held for more than one year, has Unrecaptured Section 1250 Gain, and is taxed at a maximum rate of 25% instead of ordinary income tax rates if had been held less than one year.