Rock-bottom Siena held their own against their title-chasing opponents but it still came as a shock when captain Vergassola put the visitors ahead in the 73rd minute.
Valiani sealed the win in the second minute of time added-on for Siena, who still have a negative points tally following their part in the match-fixing scandal that rocked Italy over the summer.
Inter, meanwhile, have now lost both matches at home this season and already find themselves six points behind league leaders Juventus.
They enjoyed a decent start with Dutch playmaker Wesley Sneijder shooting over the bar, while Fredy Guarin only just failed to latch on to Antonio Cassano's through ball after going through on goal.
Serse Cosmi's men refused to buckle under the pressure and showed their attacking threat with Samir Handanovic saving well from Emanuele Calaio, while Inter defender Andrea Ranocchia nearly put Gaetano D'Agostino's corner into his own net.
Sneijder continued to be a threat for Inter after the interval and the 28-year-old forced a fine save from Siena stopper Gianluca Pegolo.
Siena midfielder Alessandro Rosina narrowly missed the target from just outside the area but the visitors were rewarded for their attacking intent in the 73rd minute. Calaio teed up Vergassola, who burst into the box and struck low past a helpless Handanovic.
Stung into action, Inter predictably went on the offensive with Pegolo saving well from both a Diego Milito header and Sneijder's curling effort.
But after leaving themselves vulnerable at the back Inter were punished in
injury time. Alessio Sestu broke down the right and his cross found the unmarked
Valiani, who headed home to give Siena all three points.