For getting rid of leg cramps it's best to apply an ice pack first when the leg cramps start and then after the ice you can apply some heat to the leg cramp.
The ice will help to reduce the pain and spasms while the heat will help relax the muscles afterwards.