Cogliano's shot from the left circle on an odd-man rush got past the glove of San Jose's Antti Niemi inside the right post, breaking a 2-2 tie.
Jonas Hiller then shut the door, turning aside all 18 San Jose shots in the final period and finishing with 38 stops for the Ducks, who beat the Sharks for the third straight time this season.
Bobby Ryan scored an unassisted goal on a steal and breakaway in the second period and Luca Sbisa also scored as Anaheim ended a franchise-worst 13-game losing skid away from home.
The Sharks had a four-game winning streak snapped.
Celebrity Breakups and divorces of 2014 [PHOTOS]