The 30-year-old was in second place after the ski jump but changed all that in the cross-country section, putting on a blistering final lap to cross the line in 28:19.7 for the win.
This was 14.1 seconds ahead of German Eric Frenzel while Austrian Wilhelm Denifl took third, but it was all about Gruber in Russia as he picked up his first victory of the season and the fourth of his career.
Despite having to settle for second best in Sochi there was still plenty for Frenzel to shout about as he extended his lead atop the overall World Cup standings.
Frenzel's closest rival France's Jason Lamy Chappuis was off the pace in Russia and could only manage seventh, moving him onto 653 points.
German Frenzel moved on to 754 points while Gruber propelled himself into third overall, sitting on 568.