Palermo warmed up for their Coppa Italia semi-final second leg against AC Milan on Tuesday by beating Bari in Serie A.
Simone Bentivoglio put the already-relegated visitors in front in the seventh minute, but Fabrizio Miccoli brought the home team level before the interval.
Cesare Bovo's goal in the 53rd minute earned the Rosanero all three points and they could even afford to miss a penalty through Miccoli but still clinch the win.
Palermo coach Delio Rossi chose to rest several key players, such as Javier Pastore, in view of Tuesday's cup tie.
He did, however, give fans' favourite Miccoli a rare starting berth, and he repaid his faith.
His was the first shot on goal in the second minute, but Bari goalkeeper Daniele Padelli pushed the 20-yard effort wide of the post.
Bari, despite being already relegated, showed the same positive spirit that almost derailed Roma last weekend, and they went ahead in the seventh minute.
Alessandro Gazzi met a long, sweeping cross to the far post and passed it back across the face of goal to Bentivoglio, who had a simple tap-in from two yards out.
Alessandro Parisi almost made it two in the 24th minute with a powerful shot from 25 yards which was heading for the bottom corner, had it not been for the intervention of Salvatore Sirigu at full stretch to divert the ball behind.
Palermo levelled in the 39th minute thanks to the persistency of Mauricio Pinilla, who exchanged passes with Pajtim Kasami before threading the ball through to Miccoli, who slid it past Padelli from 15 yards out.
The home side took the lead in the 53rd minute with Josip Ilicic's cross evading everybody in the centre and reaching Bovo at the far post, giving him a simple tap-in.
Miccoli could have added a third three minutes later, but he blazed his shot over the crossbar from six yards.
At the other end, Kamil Kopunek missed a glorious chance to level when he shot too close to Sirigu after being found all alone in the area by Erik Huseklepp.
The game could have ended in the 65th minute when Matteo Darmian was fouled by Padelli in the Bari penalty area, but Miccoli tried a cheeky chip from the spot and Padelli left him with egg on his face by standing still and catching the ball comfortably.
The home side were almost made to pay for Miccoli's error when Abdelkader Ghezzal was sent through in a one-on-one with Sirigu, but his attempted lob was wildly off target and Huseklepp could only diver the ball into the side-netting at full stretch.