The “pals around with terrorists” line came straight from the McCain high command, according to reporters Dan Balz and Haynes Johnson. Marc Ambinder summarizes:

an e-mail from campaign adviser Nicolle Wallace [was] sent to Palin on the morning of October 4rd, with an attached New York Times article about Obama’s relationship with Ayers.
Turns out that the McCain campaign was a week away from running an ad linking Obama to Ayers. The e-mail from Wallace, according to Balz and Johnson, reads as follows: “Governor and Team: rick [Davis], Steve [Schmidt] and I suggest the following attack from the new york times. If you are comfortable, please deliver the attack as written. Please do not make any changes to the below without approval from steve or myself because precision is crucial in our ability to introduce this.” 
McCain HQ had suggested the following line: “This is not a man who sees American as you and I do — as the greatest force for good in the world. This is someone who sees America as imperfect enough to pal around with terrorists who targeted their own country.”

When complaining about what a diva Palin was, McCain’s people would cite the very line the campaign had given her. They claimed she had “gone rogue” and delivered the line all on her own. Well no, looks like that wasn’t the case. (Assuming the email is genuine. Ambinder’s post doesn’t say where the fellows got ahold of it.)
Does this mean that Palin isn’t a diva and whack job? I doubt it. She has a trail of bitter ex-allies from Wasilla to Juneau to wherever Republican high command is now bunkered. My guess is that the McCain people 1) wanted to keep their distance from an especially nasty attack, and 2) wanted another stone to throw at the Gal.
The “pals” revelation brings up the same lesson taught by the great post-“pitbull” letdown: never trust a story sourced to Republican political operatives.