Ribeiro scored in regulation, assisted on the game-tying goal with 2.2 seconds remaining in the third period and scored the game-winner in the shootout.
Philippe Boucher's goal in the final seconds of the third period sent the game into overtime and the Stars snapped a two-game losing slide. Marty Turco made 15 saves in the win.
The game marked the return of Dallas center Mike Modano to the lineup. Modano had missed the last 23 games due to a hip/groin flexor. He last played on Dec. 4, when the Stars also played the Sharks.
The teams meet again in San Jose Thursday.
Trader Joe's: Car crashes into Long Island store, injuring 11
Wisconsin business offering 'therapeutic cuddling' forced to close