I'm guessing you were big ring/middle cog and when you hit that climb you downshifted to the little ring while under the stress of climbing. Since you had a lot of extra chain, the front derailleur puked the chain right over the little ring and BAM!! the fun began. Hit the little ring BEFORE you are mashing the pedals. Especially if you have a compact crankset.
Since we've been given almost no info. concerning your situation, my guess is as good as you'll get until you cough up the details.