How much altitude can a glider gain only from losing speed?
You can calculate a theoretical maximum (which will be well above the actual practical height gain) by considering the conversion of kinetic to potential energy. You can also make estimates based on observing a glider performing a loop.
Calculate the kinetic energy of the glider at maximum speed as mv2/2, where m is the glider mass and v is the maximum level velocity. Then do the same for the stall speed mu2/2. Take the difference. This is the kinetic energy lost in the maneuver.
Assume this is all converted to potential energy, which is given by mgh, where m is the mass, g is the gravitational constant and h is the height gained. Rearranging this (and cancelling m) gives us

h = (v2 - u2) / 2g

Again, the real number will be much less than this, because of drag during the maneuver, but it will give you a ballpark.
According to Wikipedia, a Schleicher ASK 21 has a stall of 40 mph (18 m/s) and a top speed of 170 mph (76 m/s), which seems to be one of the larger ranges among common (and non-performance?) gliders. With g=9.8m/s^2, and calculating to two digits of precision, that's a theoretical max of h=280m or 920 feet. (Thanks K A Buhr)
When a glider performs a loop maneuver, it does so by diving to achieve a high speed, pulling up to a low speed (upside down) and then diving again. This is somewhat analogous to what you are describing, although gliders don't reach their theoretical maximum speed in the maneuver, and they may in fact go under their stall speed at the top. An examination of performance gliders looping show that they can gain several hundred feet during a maneuver.