Thornton and Marty Havlat added goals in the second period for the Sharks, who won their fifth straight and improved to 20-6-3 against the East. Antti Niemi made 35 saves for San Jose, which faced former Sharks goalie Nabokov in his first start against them.
"It was definitely weird seeing him on the other side," Thornton said of his long-time Sharks teammate. "But we had to focus because they play hard every night. We're glad to get the two points."
The Sharks (44-17-7) are battling Anaheim for the top spot in the Pacific Division. San Jose will play at the New York Rangers on Sunday at Madison Square Garden.
"Getting the lead was important and we had contributions from all four lines," Sharks coach Todd McLellan said. "Every game is big this time of year. Now we're just looking forward to our next game, which will be in a building that's always tough."
Anders Lee, Brock Nelson and Frans Nielsen scored for the Islanders, who lost for the fifth time in six home games. New York, which began a four-game homestand following a 2-1-1 trip, is an NHL-worst 9-17-8 at home.
Islanders coach Jack Capuano chose to look on the positive side, despite another defeat at Nassau Coliseum.
"That's a top-notch team we played, so any little breakdown and it's in the back of your net," he said. "I thought we had a great effort. We worked hard as a group and we were getting chances."
Nieto made it 1-0 with 6:33 left in the first off a flurry in front of Nabokov.
The 38-year-old Nabokov played 563 games for the Sharks during his decade with the franchise. He left San Jose to play in Russia after the 2009-10 season, then joined the Islanders during the 2011-12 campaign.
Demers made it 2-0 at 14:46 with a drive from the right wing for his fourth of the season.
Lee cut the Islanders' deficit in half 32 seconds into the second period, the rookie's sixth goal in eight games this season.
Thornton restored San Jose's two-goal lead with his 10th of the season at 9:32, firing a rebound past Nabokov after Brent Burns' initial shot came directly to him in the left circle.
The Islanders stayed with the fleet and powerful Sharks, and Nelson tipped in Matt Donovan's shot from the point to make it 3-2 at 17:02 of the second for his 12th goal.
But Havlat's goal put San Jose up 4-2 before Nielsen completed the scoring with his 21st goal of the season at 19:38 of the third with Nabokov pulled for an extra skater.
Johan Sundstrom made his debut for the Islanders, the ninth rookie to play for them this season.
The Sharks are 8-1-1 in their streak of 12 games against Eastern opponents. This was their first visit to Long Island since Oct. 29, 2011.
The Islanders (25-34-9) tied the franchise record for goals in a period on Monday, scoring seven in the third in a 7-4 comeback win over the Canucks in Vancouver. But they mustered little against Niemi (33-13-6), who replaced Nabokov as the Sharks starter after helping Chicago win the Stanley Cup in 2010.
The Sharks lead the NHL with 69 first-period goals and have won 40 or more games 11 times since 2000-01. ... The Sharks were without defenseman Brad Stuart (upper body) and forwards Tomas Hertl (knee) and Raffi Torres (knee). ... Defenseman Thomas Hickey is the only Islanders player to be in all 68 games this season.