The Atlas Lions wasted numerous chances during the first half and were denied late on when Iran keeper Alireza Beiranvand produced a fine save from Hakim Ziyech.
Iran's winning goal came through Morocco substitute Aziz Bouhaddouz, who put the ball into his own net with a 95th-minute diving header at the near post for a heartbreaking defeat for the North Africans.
"You could see that we should have won but that's football. We thought that the match will end goalless but we conceded late on. It hurts and it's hard to accept the result, but it happens... No one expected us to lose.”
Morocco coach Herve Renard has also admitted that they did not deserve to lose at Saint Petersburg. "I'm feeling disappointed and if we had come out with a draw I would've also been disappointed considering the way the game played out.
"A defeat, when you had quite a few opportunities, it is the worst thing that could have happened in injury time.”
The 2018 Fifa World Cup kicked-off on Thursday and will continue until 15 July, with a total of 64 matches set to be played at 12 stadiums across 11 Russian cities.
Morocco, who sit bottom of Group B after the first round of games, return to action on June 20 when they take on Portugal.