Ragnarsson's second goal of the game, and fifth of the season, snapped a 2-2 tie at 5:09 of the third period. He completed a pretty passing play, taking Owen Nolan's feed from the left point and rocketing a wrist shot past goaltender Jean-Sebastien Giguere, who was partially screened by Sharks center Patrick Marleau.
Marco Strum and Alex Korolyuk followed with goals as the Sharks defeated Anaheim for the third time this season. They are 9-1-2 in their last 12 encounters, holding the Mighty Ducks to 20 goals.
Mike Ricci had a shorthanded goal in the first period and Nolan and Brad Stuart collected two assists apiece for San Jose, which has won three in a row following a season-high four-game losing streak.
Marty McInnis scored a rare power-play goal in the second period for Anaheim and Dan Bylsma extended his career high for goals in a season with his fifth.
The Ducks fell to 1-9-2 in their last 12 contests.