San Jose led 2-1 when Grier's shot from the blue line hit Liles and deflected over goalie Jose Theodore's left shoulder. The insurance goal became a game winner when Andrew Brunette scored with 3:05 left.
"I think it hit their D-man's stick and maybe bounced off the ice," Grier said. "I was just trying to throw it at the net."
It worked out well for the Sharks.
"It's unfortunate that that ended up being the winner, but it's one of those crazy things," Liles said.
Milan Hejduk had Colorado's other goal, and Theodore had 25 saves, but he felt he should have stopped Grier's shot.
"The puck went through Liles' legs, but I still had a chance to make the save," he said. "I saw it all the way, but the puck had too many strange bounces."
It was enough to give the Avalanche just its third loss at home in 13 games.
"That was a tough break, a tough bounce," Avalanche coach Joel Quenneville said. "It was fortunate for them."
Colorado pressured the Sharks throughout the third period, and Nabokov had to make several key saves. His biggest stop came on a shot by Clark with 40 seconds left and Theodore on the bench for an extra attacker.
"You expect your goalie to make big saves," San Jose coach Ron Wilson said. "We gave up a few too many shots, but a lot of their shots were perimeter shots."
The Avalanche, which outshot San Jose 16-7 in the third period, nearly tied it early when Brad Richardson's shot from in front was deflected wide by Nabokov.
"My defense played well in front of me," said Nabokov, who has started all 25 of San Jose's games this year. "They blocked a lot of shots in front of me and let me see the shots they got through."
Michalek got San Jose on the board first with his eighth goal of the season 3:14 into the game. The lead didn't last. Off the ensuing faceoff, Hejduk skated down the right side of the Sharks zone and beat Nabokov with a shot up high 12 seconds after Michalek scored.
Bernier made it 2-1 midway through the second period. He took a pass from Joe Thornton, who had two assists, near the left circle, stickhandled around Colorado defenseman Brett Clark and sent a shot under Theodore's right arm with 10:40 left.
"I wanted to pass the puck to [Jeremy Roenick] who was coming across the net," Bernier said. "The puck came right back to my stick and I just shot it. I never saw the goal.
The Avalanche almost tied it two minutes later, but Nabokov stopped a one-timer by Tyler Arnason.
The Sharks nearly took the lead three minutes into the second period when Joe Pavelski stole the puck from Liles and had a breakaway attempt. Theodore made the save to keep the score tied at 1.
Avalanche C Joe Sakic (groin injury) was scratched for the second straight game. Before missing Saturday's 5-2 win at Los Angeles, Sakic had played in 232 consecutive games. Quenneville said Sakic is doubtful for Wednesday's game at Columbus. ... Thornton has seven points (3 goals, 4 assists) in the last three games. Five of those points have come against the Avalanche, including two goals and an assist Friday.
Copyright by STATS LLC and The Associated Press
Arena: Pepsi Center Location: Denver, Colorado
Referees: Gord Dwyer, Wes McCauley Linesmen: Mike Cvik, Ryan Galloway
Attendance: 15,213 (84.5% full)
Team Stat Comparison
Power Play Goals
Power Play Opportunities
Shots on Goal
Milan Michalek (8)
Assists: Jonathan Cheechoo, Joe Thornton
Milan Hejduk (9)
Assists: Kyle Cumiskey, Karlis Skrastins
Steve Bernier (5)
Assists: Joe Thornton, Alexei Semenov
Mike Grier (4)
Assists: Torrey Mitchell, Craig Rivet