This is an interesting question.
We have received many appropriate warnings from former Spanish PM Aznar about this and I am also sure that many people have independently considered this possibility.
I don't think AQ could repeat the Spanish experience by attacking just before the elections. I think it's far more likely that they would have their maximum effect by doing a major strike (not little ones, but a significant strike) at least a month prior to the election.
The most important thing in Spain was not the attack, but the press reaction to the attack. It was highly orchestrated - because the press is leftist and had always hated Aznar - and was coordinated with the Socialists, other more extreme left-wing parties, and the "peace" movement.
This is exactly what would happen here. But we seem to do things in increments, so I think it would take about a month for the press and the left to blame the whole thing on Bush, set Fat Teddy out to squeal, call on Fat Michael (Moore) for some deluded paranoid ravings (as Almodovar did in Spain after March 11),and get the starlets out to lead a "peace" parade. Then Kerry would walk into the job.
A month? Heck, they're already foaming at the mouth with it now. This isn't the first time we've heard this and it's only going to get worse. Of course the evil doers now only have to sit back and giggle as they watch the media terrorize the public with the story.