Well, I'm curious since this problem wasn't finally solved. I'm trying to solve it myself but I have a problem.
Ok, so my approach, as suggested, was doing it with energy and work. Work is the difference between the initial and final potetial energy of te system, right?.
So, at the beggining, when the spring was streched, we only had elastic potential energy, which was Ui = (kx^2)/2 ---> x equals the streched distance of the spring.
At the end, we had only gravitational potential energy, since the spring is in its initial position. This time this energy is Uf= mgx (the 'height' of the mass is x).
since its easy to know that x= (mg)/k, i can make the difference between the initial and final energies...
Ui-Uf= (k(x)^2)/2 - mgx = 1/2*k(mg/k)^2 - mg (mg/k) = (mg)^2/2k - (mg)^2/k = -(mg)^2/2k = W
Is this reasoning correct? I'm kinda confused about the sign (negative) of the work...