The temperature is increased, as the metal is stretched or squashed, the friction inside the metal object (both, the iron bar you mentioned and the spring) occurs. Deforming metal always generates heat.
Of course, this also happens when we compress or stretch a spring. We usually approximate springs so they only have elastic properties. In the image below (taken from wikipedia), you can see the elastic range: it is where the two curves can almost be approximated as linear (stresses below the yield strength, marked by a 2).

The problem with this approximation is, that we usually ignore the scenario that you presented in your question. Springs aren't totally elastic and thus generate heat when compressed or stretched.
So your deduction seems quite reasonable to me: In a vacuum, a real spring would indeed damp out at some point, due to the energy loss by friction.
At some point the oscillation stops (or gets imperceivable), as neither kinetic, nor elastic energy is left in the spring. However, no energy can be lost from our system, as we are in a vacuum, the heat is contained by the spring, unless it gets hot enough to actually radiate off some of its energy.
Then we wouldn't be talking about a spring anymore though ^^