Frozen cables happen because you've got moisture in the cable and housings. This can happen fairly often if you bring your bike inside after they've been wet and then have it back out long enough for that moisture to freeze. Two things can help.
First, make sure your housing covers as much of the cables as possible. Second, use a cable lubricant, which will help keep moisture out.
WD-40 should not be used on brake systems, and should only really be used on your bike as a temporary lubricant (to remove seized parts, for example). It's primarily a solvent and a de-greaser. You actually want grease on your cables.
EDIT: I was having trouble adding a comment below to answer your questions:
I use TriFlow, which is a light synthetic. You'll only need a few drops at a time, so don't worry about buying in bulk.
The other lubricant you could try, and I've seen some people in bike shops do this, is a waterproof grease, the same stuff people use on their bearings and threads.
Generally, I look for light oils for my cables, as others tend to gum up in the housing, but they should be good in a pinch.