Once again the "don't sue me" disclaimer, talk to a tax professional. 
You don't have to rent out real estate to make it an investment. Your first, second or third home is an investment. Many people buy land and other real estate with no intention of renting it and then sell it for a profit.
Next, you have investment property, you do a 1031 exchange and now you have bigger investment property. Then you decide to move into your investment property, this should not be a taxable event. If you live there long enough (2 of the last 5 years) and you've held it for 5 years, and then you sell it, it will be your primary and the tax break kicks in. There are no tax issues until you sell it. Also since you only need to be there 2 of the last 5 years, it's possible to have two primaries for tax purposes.
This explains it better than I did:
http://www.bankrate.com/brm/news/rea...20041018a1.asp