Milgram experiment clearly shows relative weights with which we perceive two alternatives : 1. a negative effect on ourselves vs. 2. a negative effect on somebody else.
In the experiment the 1. was practically non-existent, zero - some researcher telling you what to do, no real authority, no any chance of bad consequences, while 2. - electric shock, heart attack - hard to beat, yet people still chosen 2.
Now, in the torture situation we have the alternative 1. with reasonable perception of potential bad consequnces much higher than in the experiment, ie. pretty seriously sounding very plausible "or else..." from real authority while 2. is significantly lower because it is just terrorist, bad guy, and who will be tortured anyway. People making choice 2. when difference was higher (in the experiment) necessarily and obviously means that they would make such choice when difference is less, like in this case of torture.