Milan earned a draw thanks to a second-half penalty from Jeremy Menez.
El-Shaarawy ended his 622-day wait to find the back of the net as he put Filippo Inzaghi's side ahead early on at the Stadio Luigi Ferraris on Saturday, but high-flying Sampdoria replied on the stroke of halftime through Stefano Okaka.
Eder then put the club in front almost immediately after the restart, before Milan was awarded a dubious penalty after 65 minutes – which was cooly tucked away by Menez.
Despite a frantic climax to the game, which included Daniele Bonera being sent off for a second booking for the visiting side late on, both teams lacked the cutting edge to snatch a winner - although Diego Lopez was called upon to make a fantastic save in the closing minutes to deny Roberto Soriano a Sampdoria winner.
Milan has made an indifferent start to 2014/15, and headed to Genoa without a win in the previous three Serie A matches.
Inzaghi restored El-Shaarawy to the starting lineup in place of Fernando Torres, and the Italy forward repaid his coach's faith after just 10 minutes when he put the visiting side ahead with a superb solo effort.
He broke clear of the Sampdoria defense down the left flank after linking up with Menez, before cutting inside onto his right and curling a shot into the bottom corner.
Sampdoria - still unbeaten at home all season - struggled to gain a foothold in the game, with Michael Essien and Nigel de Jong controlling the tempo for the visiting side.
Sinisa Mihajlovic's club became increasingly frustrated by Milan's dogged tactics, with forward Okaka having two firm penalty claims waved away by the referee.
However, the side leveled things up just before the break when Okaka latched on to Manolo Gabbiadini's delightful cross from the left and tucked a shot away from close range.
Suddenly, Sampdoria had burst to life, and took a deserved lead six minutes into the second period when sloppy Milan defending allowed Eder to bundle the ball home from inside the six-yard box.
The Brazilian stole in unmarked to notch his second of the season after Pedro Obiang's thunderous header had rebounded off the post following a well-worked corner routine.
From there, the home team looked set to go on and step up the tempo, but Milan was back in the game soon afterwards - albeit controversially as the referee deemed that Menez's cross had caught the hand of a Sampdoria defender.
Frenchman Menez, who arrived at San Siro in the close season from Paris Saint-Germain, took the resulting spot kick, sending Sampdoria goalkeeper Sergio Romero the wrong way.
That gave Milan the impetus, with El-Shaarawy and Menez becoming increasingly prominent in the attacking third as the half wore on.
The visiting side was on top heading into the final period, with Giacomo Bonaventura going close with a venomous drilled effort.
The team's hopes of a late winner were hit in the 85th minute when captain Bonera received a second yellow for impeding Okaka just outside the area.
Sampdoria could not make the numerical advantage pay however, and as Lopez reacted smartly to keep out Soriano's vicious shot, and Milan hung on to claim a valuable away point.