Serie A Wrap: El Shaarawy ends Milan drought
Back in the starting line up in place of Fernando Torres, El Shaarawy put Filippo Inzaghi's side ahead early on at the Stadio Luigi Ferraris, cutting in on his right foot to curl a sublime shot into the bottom-right corner of Sergio Roberto's goal - and in doing so finding the net for the first time since February 2013.
But high-flying Sampdoria were not to be deterred and after having two penalty appeals waved away by the officials, they replied through Stefano Okaka.
He latched onto Manolo Gabbiadini's cross to tuck home his second goal of the season as the first half drew to a close.
And the hosts took the initiative soon after the interval, when Eder bundled home from close range after Pedro Obiang's powerful header had rebounded off of the woodwork.
Milan were on the rocks as Sampdoria pressed for a third, but Inzaghi's side gained a reprieve when they were awarded a dubious penalty after 65 minutes, as Jeremy Menez's low cross was deemed to have struck the hand of a Sampdoria defender.
Menez calmly dispatched the resulting spot-kick himself and despite seeing Daniele Bonera sent off for a second bookable offence late on after obstructing Okaka, Milan held on - although Roberto Soriano forced Diego Lopez to make a spectacular save to preserve their point.
In Saturday's other encounter, Atalanta ground out a point in a dull 0-0 stalemate at Sassuolo, who have now extended their unbeaten run to five league matches.
The visitors looked the more likely to take the spoils from a game of few chances, with midfielder Cristian Raimondi hitting the post with just over 15 minutes remaining.
Atlanta are now unbeaten in three, while Sassuolo move into 13th place in Serie A.