Napoli had the first clear chance of the match in the seventh minute when Goran Pandev's free kick was headed against the bar by Paolo Cannavaro and Juan Zuniga was then denied just seconds later by Federico Aligardi.
However, it was Bologna who took the lead as Diamanti was put through by Robert Acquafresca before slotting the ball past Morgan De Sanctis.
Napoli were spurred into action by Diamanti's goal and put the hosts under intense pressure for the rest of the first period with Edinson Cavani coming closest when his shot struck the bar.
The away side's dominance continued in the second half and substitue Ezequiel Lavezzi came closest to an equaliser but his powerful long range effort flew just wide.
Despite Napoli controlling the game, it was Bologna who scored the crucial second goal when Rubin was put clear by Matteo Di Vaio and the substitute finished emphatically past Sanctis.
The game seemed to be finishing quietly in Bologna's favour until the final moments where two red cards were shown following a violent disagreement.
Zuniga's foul on Rubin sparked a melee involving a number of players, which saw Blerim Dzemalli and Archimede Morleo both sent off for their part in the flashpoint.