The Blackhawks rallied twice in the contest, once from a two-goal deficit, but had no answer for the Sharks' late offense that allowed them to snap a two-game skid.
Chicago has lost seven in a row.
San Jose took a 2-0 lead after one period, but Marcus Kruger scored twice for the Blackhawks during the opening half of the middle period.
Ferriero put San Jose in front for good on a slap shot at the 5:40 mark of the final stanza and McGinn added an insurance goal on the power play with 5:56 remaining.
Exploding whale video goes viral on Internet
Selena Gomez drops F-bomb, walks off stage during Jingle Ball performance