WONDERS never cease: Ayatollah Khomeini now acknowledges that Iran faces a threat from the Soviet Union -- one even equal to the threat he believes is posed by the United States. This is news. In the months since terrorists seized the American hostages, Iranians have acted as though they had a special indulgence to ignore the knowledge that they live in a dangerous world.

But how does Iran mean to assure its security? Defense Minister Mustafa Ali Chamran offered his thoughts too the other day. He stated confidently that since the Soviet Union would come to Iran's aid if the United States attacked and the United States would come to its aid if the Soviet Union attacked, Iran was secure. What a theory.

You would not think an Iranian defense minister would have to be reminded that if Soviet forces entered Iran, it might not make much difference whether their ostensible purpose was to attack or to aid. They would likely want to stay around, at least until they had accomplished the purposes for which, say, Soviet forces entered Afghanistan. An Iranian who would repose some substantial part of his nation's security on the premise of Soviet disineterest is ignoring not only geopolitics but fairly recent history. But for American insistence after World War II, a good chunk of northern Iran, occupied then by the Red Army, would be a Soviet province today.

Now suppose Moscow invaded Iran, or found a flunky to summon Soviet forces, or sponsored the secession of a province, or whatever. Mr. Chamran counts on oil and strategic necessity to draw the United States to Tehran's side. But these factors do not operate automatically: an American rescue mission would still require a political decision at the time. Nor is the "Carter Doctrine," in which President Carter said the United States would use force to halt a Soviet drive to the Persian Gulf, self-triggering; it is a guideline, not a battle order, and it, too, would take a political decision at the time. Mr. Carter did decide, after the Soviet attack to Afghanistan, to stop trying to impose further sanctions on Iran. He did so, however, in the expectation that his gesture would facilitate the freeing of the hostages. The longer they are held, the less inclination, interest and leeway any president will have to lift a finger for Iran.

Mr. Chamran's smug equation offers Iran the worst of both worlds. Accepting Soviet aid is accepting a ride on a tiger. Expecting American aid is counting, unrealistically, on a free ride. The security of Iran hinges on its government's decision to break free of revolutionary illusions and to distinguish potential friends from persisting foes. The single act that puts and keeps Iran's security in jeopardy is the continued captivity of 50 Americans. The greatest threat to Iran is from Iran.