The goals were the first of the season for Ribeiro, whose 16-game scoring drought was the longest he has had at the start of a campaign during his 11-year career.
San Jose was in control with a 4-2 lead before James Neal tipped in a shot to start the Dallas comeback. Ribeiro's tying goal came just 19 seconds later.
Ribeiro, a consistent 20-goal scorer throughout his career, put a backhander past Antti Niemi to give Dallas its second straight win after a three-game losing streak.
The Sharks scored four straight goals after falling behind 2-0, two of the San Jose scores being the eighth of the season for both Logan Couture and Patrick Marleau.
Kari Lehtonen got the win by stopping 35 shots. Niemi made 36 saves. The Sharks had won four of their previous five -- all of those victories coming at home.