For what it's worth, I think that Obama's "putting lipstick on a pig" line was an unintentional, but still unfortunate remark (it is interesting to note that while I don't think Obama intended it as an attack on Palin, the partisan crowd certainly recognized it as such). As George Allen learned much to his detriment in 2006, once something is out there it doesn't matter what your original intent was or whether you even realized that what you were saying was offensive. In this campaign at this time, using "lipstick on a pig" was not prudent.
UPDATE: VDH makes a compelling argument that the insult was intended:
In all the furor over the Obama "pig" quote, commentators forgot to examine his entire attack:
"You can put lipstick on a pig. "It's still a pig."
"You can wrap an old fish in a piece of paper called change. It's still gonna stink."
When read in the entire context you can see what he seems to mean with his dual animate male/female references and why he probably evoked two metaphors: most would think that Obama is talking about both on the ticket and his anger how each has expropriated his change motif.
So in that sense he appears both to insult the 72-year old McCain as the "old fish" that is still going to "stink", and to refer to Palin, who had famously evoked the metaphor of lipstick in a nationally televised address, as still the pig despite the lipstick.
The fact that he used two metaphors to attack the two, and used expressions referring both to age and Palin's recent use of "lipstick" don't seem to be accidents and that's why the cooing crowd got the old fish=McCain;lipsticked pig=Palin immediately.