The visitors took the lead on 20 minutes after Andrea Ranocchia made a hash of a set piece. The ball ricocheted off the boot of the unlucky defender and a teammate before falling invitingly for Gianni Munari to roll home from only a few yards.
Inter introduced Esteban Cambiasso at the break to reinforce the midfield and the move turned the game on its head. Palacio fed Milito who was bundled over by Costa in the box. Costa was given his marching orders for a quick return to the Serie A sin bin and Milito levelled things up, sending his spot kick off the upright and behind a rooted Romero.
The home side took advantage of the extra man. Antonio Cassano rolled back the years with two assists to give Inter a two goal cushion. After a visitors attack broke down, Cassano picked up the ball and went on a surging run. With no defenders willing to put a tackle in, Cassano was allowed to put the ball on a plate for Palacio to fire the ball into the bottom corner.
For the third, Cassano stroked the ball across the edge of the box for Guarin to hit a low shot which beat Romero at his near post. The goal wasn't without controversy as Inter's Yuto Nagatomo was offside in the buildup and a furious Ciro Ferrara was sent off from the Sampdoria bench for taking his protests too far.
The visitors set up a nervy final few seconds when Eder played an intricate one-two and dribbled past the entire Inter defence in the box before slotting the ball under Samir Handanovic's legs.
Inter: Handanovic; Zanetti, Ranocchia (Silvestre 85), Samuel, Pereira (Nagatomo 62); Mudingayi (Cambiasso 46), Gargano, Guarin; Palacio, Cassano, Milito
Sampdoria: Romero; Berardi (De Silvestri 53), Gastaldello, Rossini, Costa; Munari, Tissone, Poli (Renan 59) (Maxi Lopez 78); Estigarribia, Soriano, Eder
Goals: Munari 20 (S), Milito pen 52 (I), Palacio 68 (I), Guarin 82 (I), Eder 92 (S)
Sent off: Costa 51 (S)