The pain from a herniated disc is due both to pinched nerves and to reactive muscle spasms.
The heat will help relieve the muscle spasm
related pain. Typically nerve pain
will be more responsive to application of cold packs. Generally speaking, pain is a very subjective experience. Whether heat or cold works better for you depends on your individual sensation.