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.
Susan Sarandon 'very excited' about daughter's pregnancy
Teacher apologizes for showing sexual image of herself in class