Remember in Rocky III, when Rocky gets too cocky, starts living "large" and then loses to Clubber Lang (Mr. T)? Well, Apollo helped Rocky turn it around by making him train in a really grungy, basic gym in L.A... Eventually, he got "hungry" again (apologies to anyone who never saw this brilliant piece of cinematic drama).
That's pretty much what happened to McCain. The bad situation forced him to address issues that, had the campaign not completely imploded, might have been swept under the rug. It also gave him back the "eye of the tiger,".
He was lucky, though, that the crisis occured early enough in the year for him to rebound...