"If someone lived in one state and owned a firearm, left the gun in the first state and moved to and established residency in another state, could that person go back to the first state and "legally" (assuming the 2nd Amendment didn't exist) sell the gun he had stored there in a private party sale to a resident of the first state?"
You must be a resident at the time of transfer, this sounds to me like your are an EX-resident of the first state.
" What if the seller also has a home in the first state, but it is not his "primary" home?"
If one owns two homes you are a resident of a state when you are occupying a house in it... this ATF FAQ entry covers a similar situation
from the ATF web site...
B12) May a person (who is not an alien) who resides in one State and owns property in another State purchase a handgun in either State? [Back]
If a person maintains a home in 2 States and resides in both States for certain periods of the year, he or she may, during the period of time the person actually resides in a particular State, purchase a handgun in that State. However, simply owning property in another State does not qualify the person to purchase a handgun in that State.
[27 CFR 478.11]