i would suggest contacting a good financial advisor before making a decision - it really depends on your goals, and when you want to retire, what kind of returns you want to make, etc.. i would think most good advisors would not encourage you to pay off the loan unless you sell. for one, interest rates are amazing right now (and historically speaking). so you aren't paying much to borrow the money, so don't tie up $31k just to get rid of a payment - however, if you only plan to keep that $31k in a 5% or less money market for 30 years then based on a returns standpoint it could make sense to pay it off since your mtg rate is higher, at 5.8%.
but do you have at least 6 months worth of reserves elsewhere if you did use the $31k to pay down the loan? if not, then this decision is a no brainer - keep the loan open and make sure to keep enough money available.
however, considering you have a grasp of real estate investing based on the rehab of a foreclosed home, i expect that you want to make much higher returns on any investment you make. although a primary residence isn't an 'investment', analyze it as such if you are deciding you might put money there.
i have a decent chunk of reserves saved up, but if i had your liquidity i would look for much better returns w/that chunk. if you wanted to make a solid return to outweigh what you are borrowing w/the mtg, i'm sure that a handful of the investors on this site would offer you at least 10-18% return if you let them borrow some of that money to fund part of their deals. and even though you are making a mtg payment, the 5.8% interest rate is minimal in comparison to getting a possible 15% return (or possible profit share to increase ROI depending on how you structure if you decide to lend your money as a private investor). crunch your numbers - the higher ROI opportunities should be out there for you. the higher return will cover the 5.8% you are borrowing and then some.
but as i suggest, you should talk to a financial advisor first or some other financial professional to see what works best for YOU. it wouldn't hurt if they knew a thing or two about real estate investing either.