Lovejoy fired a shot between goalie Antti Niemi's legs as the Ducks earned their third preseason win.
Tomas Hertl gave the Sharks a 1-0 lead with 5:18 left in the first when he tapped a rebound past Viktor Fasth. The Ducks tied it early in the second when Emerson Etem stuffed in a shot from the left corner, but Tyler Kennedy restored San Jose's edge with a short-handed goal at 8:18.
Corey Perry netted his first goal of the preseason with 3:59 left in the second to make it 2-2.
San Jose's Raffi Torres collided with Etem at 6:34 of the second period as Etem tried to avoid going offside. Torres got back to the bench, but left the game soon after and didn't return. Etem injured his left leg, but returned briefly. He didn't come out for the third period.
Fasth made 24 saves, and Niemi stopped 28 shots.