Heat or Ice is a great question.
Heat is less used but it can be great on muscles, like tired or fatigued muscles but it must be kept away from the joints. Ninety percent of the time you use ice because your problem will be a micro-tear (ice constricts the vessels preventing further bleeding).
When using ice the normal protocol is to put the ice on for 10 minutes and then take the ice for a further 10 minutes. You may think holding the ice on for longer than 10 minutes is better but research has found it is much better for healing if you remove the ice after 10 minutes before reapplying for another 10 minutes and repeating the cycle for an hour.
If after a couple hours it starts to hurt again, just repeat the protocol again.