I think you are referring to the release of endorphins.
http://www.healingsprings.com/ENDORPHINS.htm
In contrast to short-intensity workouts like sprinting or weightlifting, prolonged, continuous exercise like running, long-distance swimming, aerobics, cycling or cross-country skiing appears to contribute to an increased production and release of endorphins. This results in a sense of euphoria that has been popularly labeled the "runner's high."
It also may contribute to what some athletes call a "second wind." Rather than feeling pain and exhaustion while running, endorphins may help us actually feel limber and energized towards the end of a race. According to William Straw, M.D., a team physician for the San Jose Sharks, "at some point you may feel a little more energetic and you can kick-in when you did not feel like you could kick-in before."