Francesco Totti called time on his 24-year career as a Roma player with a well-timed substitute appearance that inspired the Giallorossi to beat Genoa 3-2.
The 40-year-old, who will seek a new challenge following this curtain call, basked in the adulation of the Stadio Olimpico crowd for 54 minutes before making his 786th outing for his hometown club.
Edin Dzeko had already scored his 29th goal of the season to cancel out Pietro Pellegri's history-making opener. The 16-year-old is the first player born in 2001 to notch in the Italian top flight.
Totti's lionised introduction heralded a determined push forward, with direct entry to the Champions League group stage at stake, and, after Daniele De Rossi saw his go-ahead goal scrubbed out by Darko Lazovic, Diego Perotti ensured a victorious send-off for the veteran by notching at the death.
As the saying goes -- out with the old, in with the new. Totti was 16 when he made his senior debut as a substitute at Brescia in March 1993, but he did not score that day -- something Genoan teenager Pellegri achieved here.
The schoolboy born in March 2001, just months before Totti won his only Scudetto, raced onto a long pass down the right wing and, after protecting the ball from Kostas Manolas, found the back of the net with a deft finish.
Genoa almost made it two when Wojciech Szczesny misjudged Diego Laxalt's movement, allowing Raffaele Palladino to shoot just wide of the mark.
In the 10th minute Roma were level. Dzeko, the prolific Bosnian who has so impressively kept Totti out of the team this term, controlled Kevin Strootman's pass before smacking it against a post and coolly chesting home the rebound.
Szczesny was shaky again as Genoa looked to respond quickly, Palladino smashing the ball into orbit despite Roma's Polish goalkeeper going missing when Oscar Hiljemark whipped in a regulation cross.
There was a lengthy break in play when Emerson Palmieri went down clutching his knee -- the injury looked serious and the Brazil-born defender, called up for Azzurri duty on Saturday, was carried off on a stretcher.
Roma missed a chance to turn the game on its head when Dzeko was denied by brave Genoa stopper Eugenio Lamanna when clean through.
Strootman was pulling the strings in midfield and his next trick was to send Stephan El Shaarawy steaming through, yet Lamanna watched the shot sail wide.
On the half-hour mark Lamanna spared Miguel Veloso from scoring an own goal as the Portuguese sliced wildly at an El Shaarawy cross and there was time for one more opportunity before the break as Dzeko controlled the ball and drove it low at Genoa's under-siege keeper.
Nine minutes into the second half, it was time for Totti. The long-serving No. 10 replaced Mohamed Salah to rapturous applause and soon rolled back the years to pick out Manolas, with Lamanna just about covering.
Totti -- famous for his 'cucchiao' chipped finish at his peak -- lofted the ball forward for Strootman to shave paint off a post in the 67th minute and the magic kept coming from the evergreen forward as his splendid defence-splitting pass allowed El Shaarawy to test Lamanna with a bullet header.
Roma's second-most fielded player, De Rossi -- a mere 225 outings behind Totti -- got the goal the Giallorossi deserved with 15 minutes remaining.
Strootman's creativity finally paid off as his pinpoint cross found Dzeko, who passed the ball backwards for De Rossi to steer in a low effort.
However, a knife cut through the party atmosphere in Rome when Lazovic got past Antonio Rudiger to head in an unwelcome leveller five minutes later.
With Napoli busily putting Sampdoria to the sword in Genoa, Roma risked slipping into third place, and something had to give as full-time drew near.
Totti was not directly involved when the winner came, as Radja Nainggolan's free kick found Dzeko before falling to Perotti just a few feet from the goal-line.