Nicola - already renowned as a survival specialist following previous miracles with Crotone, Torino and Salernitana - saw M'Baye Niang strike right at the death following earlier goals from Matteo Cancellieri and Houssem Aouar to dramatically ensure a fourth straight season of top-flight football.
With just mere moments of the season remaining, Frosinone - who lost 1-0 to fellow relegation rivals Udinese - were home and dry, but Niang's bedlam-triggering strike sent the Canaries back to the second tier alongside Salernitana and Sassuolo.
Despite starting the evening in the relegation zone - boasting 33 points from 37 fixtures to sit one point below the dotted line in 18th - Empoli had their fate in their own hands heading into the final day.
As a result of 17th-placed Udinese (34) and 16th-placed Frosinone (35) facing each other, Nicola's side knew that victory would keep them afloat in the big time no matter the result in the crunch basement battle at Stadio Benito Stirpe.
A point would have sufficed for Empoli's survival had Udinese suffered defeat at Frosinone, but the Azzurri finishing level on points with Le Zebrette would have seen a two-legged relegation playoff materialise.
Niang injury-time heroics keeps Empoli up
Empoli's bid to stun the Giallorossi and rise above the demotion line began in perfect fashion, as Cancellieri coolly side-footed home the opening goal in the 13th minute, with Roma at sixes and seven at the back early doors.
Bryan Cristante thought that he had forced Roma level in the 21st minute after an almighty scramble in the box, but the Italian's strike was disallowed for offside following a lengthy VAR review, handing Empoli a vital lifeline.
However, Daniele de Rossi's men would wipe out their hosts' slender advantage on the stroke of the break, as Angelino's deft delivery from the left byline was on the money for an unmarked Aouar, who nodded home from a few yards out.
The Frenchman's leveller in the 45th minute did not knock Empoli's confidence, though, and Nicola's men almost retook the lead in the 69th minute through Razvan Marin, whose 25-yard rocket thumped the crossbar and sailed over the top.
As news filtered though that Udinese had taken the lead against Frosinone - making Empoli's need for victory all the more greater - Roma's Stephan El Shaarawy had a goal chalked off for offside in minute 84, four moments before Cancellieri sent a gilt-edged header wide from inside the six-yard box.
However, the Empoli number 20 would not have to lament that seemingly fatal miss, as in the third of five added minutes, he turned provider for Niang to calmly slot home first time and spark Azzurri pandemonium.