A missed penalty and a bad goalkeeping error cost Ajax dearly as they lost a halftime lead and now face a tough task in next Thursday's return leg in Rome.
The home team went ahead from Davy Klaassen's goal six minutes before halftime and should have doubled the lead soon after the break but Dusan Tadic's penalty was saved.
Ibanez secured the last-gasp win as he chested down a poorly cleared corner before slamming the ball home from close range to end a 24-match unbeaten run for the Dutch side.
Roma showed more early intent as Bryan Cristante's long- range effort swerved dangerously and produced a full stretch save from Scherpen, deputising for veteran Maarten Stelekenburg who missed out on playing against his old club because of injury.
Cristante shot over the crossbar from much closer at the end of an elaborate free kick routine but it was Ajax who broke the deadlock in the 39th minute, from a move that began in their own half.
A series of swift passes put them on the edge of the Roma penalty box and when defender Gianluca Mancini backed off, it allowed Klaassen time to play a one-two with Tadic before sweeping home from close range.
Antony miscued from a similar distance when another Tadic pass presented the young Brazilian forward with an ideal opportunity to double the home team's lead.
Tadic was bundled over by Ibanez and got up to take the 52nd-minute penalty but hit the ball at a comfortable height for Roma goalkeeper Pau Lopez to parry away.
"I should have scored it but we had more chances after that we did not take. Football is sometimes good to you and sometimes not," Tadic told Dutch television.
Roma took full advantage of the let-off to equalise five minutes later as Pellegrini's free kick squirmed out of Scherpen's grasp for a soft goal.
Lopez made another excellent stop to deny substitute Brian Brobbey in the 69th minute and tipped Antony's volleyed effort over the top before Ibanez's late heroics put the Serie A side in control of the tie.