Ice is the best immediate treatment for acute injuries because it reduces swelling and pain. Ice is a vaso-constrictor (it causes the blood vessels to narrow) and it limits internal bleeding at the injury site. Cold therapy is also helpful in treating some overuse injuries or chronic pain. An person who has chronic knee pain that increases after running may want to ice the injured area after each run to reduce or prevent inflammation.
Heat therapy is typically used for chronic injuries or injuries that have no inflammation or swelling. Sore, stiff, nagging muscle or joint pain is ideal for the use of heat therapy. People with chronic pain or injuries may use heat before exercise to increase the elasticity of joint connective tissues and to stimulate blood flow. Heat can also help relax tight muscles or muscle spasms. Don't apply heat after exercise. After a workout, ice is the better choice on a chronic injury.
The Use of Ice in the Treatment of Acute Soft-Tissue Injury. A Systematic Review of Randomized Controlled Trials; Chris Bleakley, et al, The American Journal of Sports Medicine 2004, Volume 32.