Does a contracted spring become warm? As far as I remember, if we stretch a solid iron bar mechanically, some portion of the work done by, say, the hydraulic pistons, makes the bar's temperature increase before it pulls apart. I want to know if the same happens for a simple spring. Can we say that if we contract a spring, its temperature would slightly increase? If so, it seems that the oscillation of spring would soon damp out even in vacuum space. Is this deduction defendable?
On the other hand, can we say that all of the work done by the pistons is converted to heat and leaves the system (spring) or just a specific portion of it?
 A: 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 ^^
A: The energy recovery process in a piece of spring steel that is elastically cycled is almost perfect; almost no heat is generated in this process and the spring's temperature will rise very little.
The intrinsic mechanism causing energy loss in the elastic region is referred to as internal friction or hysteresis loss and is negligible in most ordinary metals. It becomes significant in materials that have small or no linear stress-strain ("elastic") region in their stress-strain curves.
