Ok, it's the same principle as in the campaign when Kerry was trying to run on the "war hero" tag: by reminding the voters that, in fact, he HAD to bring up his Vietnam experience, it instead reminded them that Bush had fought the terrorists since 9/11 and that Vietnam was irrelevant. It actually worked against him, which is why the attacks on the Swifties were utterly stupid---they kept the issue of national security alive when he should have been trying to get the debate over to the economy, jobs, etc.
With the ports, all this debate does is to reaffirm in peoples' minds that Bush, NOT the Dems, has been fighting this war for four years (largely without their support). So even if he's wrong on the port issue (I don't think he is), the OVERALL message is that, "Bush has been fighting the terrorists." Moreover, by pushing the security/terrorism issue to the fore, it dooms the Dems, as they cannot ever win on this issue.