For a good part of the war, the Iraqis were actually not that materially superior. The balance of materiel realistically did not shift in Iraq's favor until the late 1980s. During the Shah's era, Iran built up the most powerful military in the Middle East, trained and equipped with the intention few holding the Soviet Union at bay. In 1980, Iran had 500 helicopters to less than 50 Iraqi helicopters. It also had 445 fighter jets compared to under 350 for Iraq. Iran's fleet included many advanced F-14s. By the end of the war, less than two dozen F-14s remained operable. In the early days of the war, this material superiority ended up being decisive, especially in the air. Iranian attack helicopters were one of the most competent air units on both sides of the war and dealt heavy damage to Iraqi armor. Meanwhile, Iran completely triumphed in the air war and was able to destroy Iraq's oil industry in the initial counter-attack against the Iraqi invasion.
As for the revolution, instability died down and largely ended after the Iraqi invasion. The concept of Gheirat - or the rallying of the many ethnic groups in Iran to defend the country from outsiders - unified the Iranian people in the face of invasion. Despite this, Mojahedin e Khalq and other opposition groups were still able to stage marches involving hundreds of thousands of dissidents nationwide as late as 1981, but the government had "turned the corner" of its power struggle after the Iraqi invasion and became more legitimate in the eyes of secularists and skeptics.
Further, it is hard to envision, even without an Iraqi invasion, the fall of the Islamic Republican regime. While the opposition to the regime was well armed - the strongest single faction being MeK, who had fought for years - they were not popular. Secularists, democrats, and socialists were popular primarily in the cities. MeK itself had a small support base. The Islamic Republicans, meanwhile, had the broad support of most of the clergy, rural people, and the bazaari merchant class, all of which were left behind under the more secular reign of the Shah, and none of which were willing to side with the Islamic Republicans' more secular enemies. In essence, the Shah tried to build new Iran, but failed to strike a balance. Both new and old Iran rejected him and his small elite. Once the revolution happened, new Iran discovered to its dismay that old Iran outnumbered them completely. Ironically, Iran would not become the highly urbanized country it is today until the Islamic Republican era.
In 1981-82, Iraqi generals failed to notice a huge militia buildup on their front, dismissing it as refugee concentration. This left them vulnerable to an infantry assault which collapsed their frontline and allowed a numerically superior (and still well equipped) Iranian force to eject them from their country. However, the myth of a competent, heroic, and innovative Iranian army facing off against a bureaucratic, inept Iraqi command is just that - a myth. Iran in 1981 outnumbered Iraq in both personnel AND aircraft in all categories. Iran's most glorious victory was driven by completely superiority in all fields.
As early as the 1981-82 offensive, Iranian organizational deficiency already manifested. In 1981, the army, launching an offensive without the support of the Revolutionary Guard paramilitary, lost hundreds of tanks when they got bogged down in the mud of the Khuzestan wet season. Briefly from 1981-82, the competent army general Shirazi was placed in command both of the Guards and the army. This resulted in effective cooperation that allowed the Iranians to win totally in their counter-attack.
However, from 1982-84, the Revolutionary Guards fought a largely separate war to the army. Shirazi was appointed to invade Kurdistan - which he did rather effectively - while the 27-year old IRGC commander Moshen Rezaee (with no military experience) controlled the higher priority Southern Front. Rezaee ordered human wave attacks reminiscent of world war 1. By 1986, this "hard learning" approach did bring some measure of competence to the IRGC, which was able to pull off a surprise invasion of the Al-Faw peninsula. Meanwhile, by 1986, the IRGC had become more tactical due to changes in protocol demanded by the army.
So in summary, there was nothing brilliant about Iran's approach. They just had more, and 1981-82 was the only period in their war effort besides the very end (reforms too little too late) where Shirazi was placed in control of both the Revolutionary Guard and the army - this way competition between the two didn't undercut the war effort.
Sources:
The Lessons of Modern War - Volume II - The Iran-Iraq War
Amanat, Abbas. Iran: A Modern History
An Analysis of the Iran-Iraq War: Military Strategy and Political Objectives.
A highly fanatical corps of volunteers and militias (which Sepah was at that time) that were responding to religious and nationalistic calls of duties. While the revolution of '79 did mobilise all kinds of socio-political groups to overthrow the Shah, remember that the revolution was quickly followed by a civil war between different political groups and a ethnic uprising by the Kurds in Northwestern Iran that eventually even bogged down approximately 25 % of Iran's armed forces in that part of the country.
The event that truly unified the country was the Iraqi invasion and subsequent occupation of cities like Khorramshahr. It gave the ruling clerics a perfect opportunity to get the population behind their governance. Within months after Saddam ordered his troops to invade Iran, hundreds of thousands of Iranians had voluntarily enlisted themselves to join the front lines. Many of these volunteers were inspired or motivated by references to Shia martyrdom, as Saddam and the Iraqi invaders were compared to the same forces in the 7th century that slaughtered the grandson of prophet Muhammad, Hussein ibn Ali, who holds a important position in Shia Islam as the third Imam and whose martyrdom is annually commemorated by Shia Muslims.
This meant that the Iranian leaders were overseeing a population at wartime that was willing to sacrifice a lot to fight off a foreign enemy that enjoyed significant amount of regional and international support. So while the Iraqis enjoyed materially and numerically superior (professional) forces, Iran's troops were highly motivated and willing to participate in risky operations (sometimes referred to human wave attacks, although the reality is much more nuanced) that during some battles, certainly in the beginning, were proved to be quite effective against the Iraqis.