Application of ice to the Knee decreases the inflammation and swelling in the Knee and thus improves the symptom of pain. Remember that ice is applied over the bones of the Knee Joint.
Heat can damage the Articular Cartilage and hence should not be applied directly over the joint. It is very useful to relax the muscles around the Knee Joint. Hence it relieves symptoms of spasms if applied over quadriceps (front of thigh), hamstrings (back of thigh) and Gastrocnemius (calf muscle).
Ideally heat application should be done 10-15 minutes before starting Knee physiotherapy and ice application should be done for 10-15 minutes after physiotherapy.