What would end as a scintillating 4-3 victory for the visitors to the Stadio Luigi Ferraris sparked into life when Samp striker Nicola Pozzi opened the scoring in the first half.
Sassuolo, who earned a first ever away win in the top flight, hit back after the break with Berardi equalising before turning the game around from the penalty spot after Andrea Costa saw red.
Antonio Floro Flores extended the visitors' lead, but goals from Eder and Lorenzo De Silvestri set Samp on course for a share of the points.
They took nothing from the game, though, as Berardi settled the end-to-end encounter with another spot-kick right at the death.
Samp goalkeeper Angelo Da Costa got his first of many feels of the ball in the 11th minute as Floro Flores found the target with a free-kick.
Floro Flores' next chance came six minutes later but once again Da Costa denied him.
In the 19th minute Samp took the lead against the run of play. Costa supplied the assist with his head and Pozzi could not miss.
Marcello Gazzola might then have scored a first-half equaliser, but he took too long to shoot when all alone in the area.
After the break Eusebio Di Francesco's men returned to the Marassi pitch fiercely determined to turn the game around.
Moments after the restart Berardi struck the first blow of a frenetic second half, notching his third goal of the season in tucking home Alessandro Longhi's cross.
The goalscorer went down in the Samp box in the 51st minute and, while Costa started the trudge back to the changing rooms after picking up his second yellow card, Berardi converted the penalty.
Floro Flores fancied the third goal and was unlucky not to find it at the end of a slaloming run, Da Costa snaffling his weak finish.
The Neapolitan would not be denied in the 63rd minute, however, his fierce and unchallenged drive finding the back of the net.
The game was suddenly wide open now and, two minutes later, Samp halved the deficit through Eder.
Sterling work from Pozzi down the right wing freed the Brazilian to shoot he kept his side alive with a right-footed finish beyond Gianluca Pegolo.
There was plenty of drama left to come.
In the 81st minute, De Silvestri wheeled away to celebrate in front of the Sampdoria fans after heading home an equaliser from a corner.
Delio Rossi's men thought they had managed to rescue a valuable point after succumbing to a swashbuckling fightback, but Sassuolo were not quite finished.
The Marassi clock showed two minutes remaining when De Silvestri felled substitute Diego Farias in the Samp box.
Berardi stepped up to the spot once again before completing his hat-trick with a minimum of fuss to clinch the most dramatic of wins for the promoted side.