McCain really hates how much of a pandering douchebag the election has turned him into. McCain also hasn't forgiven the Republican leadership and establishment for the crap they threw at him in both this and the 2000 primaries.
This is a big "fuck you" to the party machine: a choice they have to publicly love (she's got an "in" with almost every interest-based Republican constituency), but a choice that they can't but hate in private (because she's a whistleblower who goes after powerful and corrupt Republican lawmakers).
Mind you, I don't think a McCain/Palin administration would be good for the country; I think it would be a disaster. It would also be a disaster for the Republican Party (or at least some people in the Republican party).