After Perry had tied the game in the second period, Selanne raced down the right wing and blasted a slap shot past San Jose goalie Evgeni Nabokov giving the Ducks the lead during a power play five minutes into the third.
James Wisniewski added a shorthanded goal and goaltender Jean-Sebastien Giguere made 23 saves to secure the Anaheim win in the first contest between the teams since the Ducks eliminated the President Trophy winning Sharks in the opening round of the playoffs last spring.
Rookie Benn Ferriero scored a first period power play goal for the Sharks. He also assisted on goal by Marc-Edouard Vlasic in the final minute.
Nabokov had 20 saves for San Jose, now 2-2 in the preseason.
Dany Heatley skated on a line with Joe Thornton and Devin Setoguchi in his second appearance in a Sharks uniform after being acquired in a trade with Ottawa on September 12. He generated a single shot on goal while logging 17:50 of ice time.
After Ferriero's goal had given San Jose a 1-0 lead, Perry, who led the Ducks in goal scoring last season (32) tied the game, whirling from behind the net and swiping the puck past Nabokov late in the second period.
The Ducks improved to 3-2 in the preseason. They have been playing without all-star center Ryan Getzlaf who continues to practice with the team while recovering from offseason sports hernia surgery. Getzlaf hopes to play in at least one of Anaheim's final three preseason games later this week.
Copyright by STATS LLC and The Associated Press
Arena: Honda Center Location: Anaheim, California
Attendance: 14,300 (83.3% full)
Benn Ferriero (power play) Assist: Joe Thornton, Frazer McLaren
Corey Perry Assist: Bobby Ryan
Teemu Selanne (power play) Assist: Saku Koivu, Ryan Whitney
James Wisniewski Assist: Petteri Nokelainen, Andrew Ebbett