From [link|http://www.weeklystandard.com/Content/Public/Articles/000/000/000/318qpvmc.asp|an op-ed piece arguing that the real reason this happened was we haven't been interventionist enough], an excerpt on 1842 and all that:

In Afghanistan, the British suffered a serious setback in 1842 when their forces had to retreat from Kabul and were massacred--all but Dr. William Brydon, who staggered into Jalalabad to tell the terrible tale. This British failure has been much mentioned in recent weeks to support the proposition that the Afghans are invincible fighters. Less remembered is the sequel. An army under Major General George Pollock forced the Khyber Pass, recaptured Kabul, burned down the Great Bazaar to leave "some lasting mark of the just retribution of an outraged nation," and then marched back to India.

Thirty-six years later, in 1878, the British returned to Afghanistan. The highlight of the Second Afghan War was Lieutenant General Frederick Roberts's once-famous march from Kabul to Kandahar. Although the British were always badly outnumbered, they repeatedly bested larger Afghan armies.

(The author then goes on to recount how Britain subsequently dropped the ball.)