I can't think of when it was the last time that an anti-war candidate won a Presidential election during wartime? Nixon wasn't anti-war in '68....Reagan wasn't anti-war in '84.....Bush wasn't anti-war in '04....
The whole message of Nixon's '68 campaign was Democrats got us into a sh**tty war and promised to end it.
Another question:
When's the last time a candidate of the party of the President during an unpopular won?
You could say George W. wasn't too popular in 2004. Hard to tell; there weren't approval rating polls back in the 20s when the Republicans won three straight presidential elections with three different candidates (Harding, Coolidge, Hoover).