The Tehran Theocracy's hardline faction, i.e., Ahmadinejad and Khamenei and their cohorts had obviously pre-planned and pre-staged this ridiculous show of thuggish-ness in the gulf.
As to the reasons for it, here is why I think they did it:
1) To send a warning to US and Israel (however unprofessionally and clumsily); by making it coincide with Bush’s trip to Israel where he wants to unite the region against Iran and its clients Hezbollah and Hamas. The message being that they can, at any time of their choosing, attempt to blow up a hole in the side of a US navy ship (like the Yemen event during Bill Clinton.)
2) To show --once again-- that they (Iranian regime) are irrational, international thugs and rogues who do not give a hoot about international maritime protocol or law. A kind of thuggish "Don't Mess with Me" message.
3) To send a loud warning to the "reformists" (mullahs with European ties) inside the Iranian regime who are now preparing themselves to be included in the parliamentary elections in 2 months time in Iran. Khamenei made a speech only yesterday condemning those "reformists" whom he called "traitors" for calling for the presence of international observers (including American observers) during the said elections. Khamenei also heard what Bush said a day or two ago that he, Bush, supports "moderate leaders" from Tehran to Damascus to Beirut (It now seems painfully clear that our President has totally lost grip on Iran, and has lost his way on Iran altogether to the forces of appeasement in the state department who support the European mullahs faction in Iran.)
4) The Iranian regime knows that US/Bush cannot do anything militarily against them right now since this is an election year, and also due to the NIE on Iran which helped the mullahs greatly in their objectives. So, they are pulling Bush's chain by these theatrics in the gulf to show to all Arab gulf states that, as the mammoth banner inscription says above Khamenei’s head whenever he delivers a speech, “America Cannot Do a Damn Thing!” (This is, incidentally, Khomeini’s old phrase.)
So, yeah, unless something really unexpected happens between now and 2009, it seems that this President will be retreating into his bunker on Iran for the rest of his term: And that is exactly what the mullahs are hoping for.
The mullahs also hope for Hussein Obama, who has a soft spot in his heart for all Islamists internationally, to get into the White House in 2009; when we will all be in bed together with Iranian regime, and be singing kumbaya with the mullahs as conducted by Hussein Obama himself. But that will only mean that the mullahs will get us again and again, on the time of their choosing. And that the regime will, on a more likely basis than not, get their nuclear weapons during Obama’s term.
Treacherous days await America.