In general, ice is best for most acute type pain. It has been proven to be a more effective pain blocker than heat in most cases where recent injury or inflammation is involved.
Heat is more often used for chronic, non-inflammatory conditions such as arthritic degeneration.
Ice should be applied as close to the skin as possible. 15-20 minutes works best to penetrate the tissue and have a pain relieving effect.