Carpi were relegated from Serie A, despite a win over Udinese, as Palermo grabbed the win they needed over Hellas Verona to stay up.
Palermo pipped Carpi thanks to a thrilling 3-2 win over Verona at the Renzo Barbera, with striker Alberto Gilardino describing his side's survival as a "miracle"
Carpi entered Serie A's final day needing to better Palermo's result, but a 2-1 win at Udinese was in vain as the Rosanero edged a thriller to end a season in which they have employed six different head coaches with salvation.
Franco Vazquez and Enzo Maresca scored either side of Federico Viviani's stunner to send the Sicilian fans wild and condemn Carpi to relegation in their first Serie A campaign.
Both games began with understandable nerves, but Italy international Vazquez got the ball rolling with a clipped finish from 20 yards – a goal celebrated with a huge bundle.
Giampaolo Pazzini almost lobbed home goalkeeper Stefano Sorrentino as already relegated Verona gave it their all, but the game took a huge twist as both sides had a man dismissed – Michel Morganella and Pawel Wszolek each seeing red for a clash in which it appeared the Palermo man was the aggressor.
At the same time in Udine, Carpi were awarded a penalty as Kevin Lasagna was felled in the box, Simone Verdi coolly stepping up to convert. The home team's frustrations boiled over as Cyril Thereau was dismissed for berating the referee before the game was resumed.
Verdi then doubled his tally with a wonderful solo effort and, in Palermo, Artur Ionita hit the post as the hosts' hopes hung by a thread.
And though Viviani briefly levelled the scores to put Palermo in peril, headers from Maresca and top scorer Gilardino put the home side's destiny firmly in their own hands, although Eros Pisano's late goal ensured nerves were frayed until the end.
"After a difficult season we were able to make a beautiful sports miracle," the 33-year-old told Sky Italia.
"I am happy for myself, for my team-mates and for these fans.
"We knew that against Verona would be a difficult game, but we did well and we managed to win a race that had apparently ended a month and a half ago.
"Many did not think we could survive for a month now, but we stuck together and managed to do all this."
In Udine, there was just enough time for the home fans to give one last ovation to retiring club legend Antonio Di Natale, who emerged from the bench late on and converted a penalty with his first touch to bring a party atmosphere to the Friuli that did not suit the visitors.
Di Natale was not the only veteran striker to bow out of Serie A with a goal, Miroslav Klose also scored a penalty as Lazio were beaten 4-2 by Fiorentina, a result that secured Europa League qualification for the Viola.
Fiorentina had only won once in their previous 10 games, but Matias Vecino (two), Federico Bernardeschi and Cristian Tello struck after Senad Lulic's cracking opener for the hosts.
The Stadio Olimpico faithful were keen to commemorate Klose's final day with the club, their fans holding up pictures of all of the German's 53 previous Serie A strikes for Lazio.
Elsewhere, Atalanta beat Genoa 2-1 while Empoli overcame Torino by the same scoreline.
Chievo versus Bologna finished goalless in a trio of games earlier, with nothing but mid-table positioning riding on them.