Obviously, the conventional wisdom wasn't very wise.
I don't think it is a leap to conclude that Zapatero's minions could have believed completely that a terror attack, followed by an immediate acknowledgement by al-Qaida that not only it was them, but the act was perpetrated precisely because of their leadership's stubborn collaboration with Americans, would give them a chance to win. Remember, they were behind, and nothing short of some calamity befalling the leadership would have accomplished a victory for the Socialists.