Rival young campaigners came together and clogged the capital's streets into the early hours of Thursday in a final bid to win over undecided voters before Friday's election.
The vote could determine the fate of Iran's nuclear stand-off with the West and ties with arch-foe the United States, although whoever wins, real power in the country will still rest with conservative, anti-West religious authorities.
Hardline candidate Mohsen Rezaie pulled out on Wednesday after trailing near the bottom of polls. His move is likely to strengthen the three hardline candidates left, but they still lag behind Rafsanjani, who wants closer ties with the West.
Based on opinion polls in recent days, Rafsanjani, 70, looks unlikely to win the necessary 50% to avoid a run-off between the top two candidates, possibly on 24 June.
"The election is one of the most unpredictable in the history of the Islamic Republic of Iran. All pundits believe the president will be elected in the second round," the reformist Etemad daily said.
"The election is one of the most unpredictable in the history of the Islamic Republic of Iran"
The polls show Rafsanjani's main rivals are conservative former police chief Mohammad Baqer Qalibaf, reformist Mostafa Moin, an education minister under outgoing President Mohammad Khatami. Some have shown conservative Tehran mayor Mahmoud Ahmadinejad has also gained ground.
Such polls have not always been reliable in past elections. "There is very close rivalry between Moin and Rafsanjani, and also Qalibaf is not in a bad situation," Mohammad Reza Khatami, a Moin aide, said.
Analysts say an upset Moin victory cannot be ruled out and the outcome of a Rafsanjani run-off against Moin or Qalibaf will be hard to predict.
"I came to campaign for Hashemi, to say that he has a heart of gold," said Mohsen Mahmoudi, 22, plastering campaign stickers on a busy Tehran street early on Thursday.
But some young revellers said they had come out on to the streets only to enjoy a rare chance to party and mingle openly between the sexes.
Barred from running
Several said they would not vote in a race where most of the more than 1000 hopefuls who registered to run were barred by the hardline Guardian Council supervisory body.
"We don't get any fun. We came here because tonight the police will not touch us. Anyone who votes accepts the Islamic Republic," Mehdi, 23, said as cars passed with music blaring.
Former president Akbar Hashemi
Rafsanjani is leading in the polls
Candidates have sought to win over the young, a key constituency in the world's fourth-largest oil exporter where half the population is under 25. Candidates have promised to create more jobs and allow more social freedoms.
Supporters of Moin have complained of beatings by hardliners during more than two weeks of campaigning, prompting the president to call for action against those responsible.
"I ask you to identify those offenders and introduce them to the judiciary more seriously and more quickly," Khatami said in a letter to the interior and intelligence ministries, Iran's student ISNA news agency reported.
Khatami, who is not allowed to stand for a third four-year term, was elected by landslides in 1997 and 2001 with pledges to make a freer society, but his reforms were repeatedly blocked by hardliners who control the courts and supervisory bodies.
Supreme Leader Ayat Allah Ali Khamenei, who has the last word in matters of state in Iran's theocratic system, has called for a high turnout to make Iran "immune to the enemies' plots".
Interior Minister Abdolvahed Mousavi-Lari said he expected more than half of the 47 million eligible voters, aged 15 and over, to cast a ballot.