SACRAMENTO, Calif. -- The Sacramento Kings finally found a way to pull out a game in the fourth quarter. Then they celebrated as if it was the franchise's heyday again.
Tyreke Evans made a 3-pointer from midcourt as time expired, then raced to the sidelines and jumped on the scorer's table while teammate DeMarcus Cousins screamed and beat his chest with both fists following Sacramento's 100-98 win over the Memphis Grizzlies on Wednesday night.
"Man, it feels good to get a win," said Cousins after scoring a career-high 21 points and 16 rebounds while helping the Kings snap a eight-game losing streak. "Hopefully that can be the spark that we need. Just keep playing, keep working hard and we can turn this thing around."
Sacramento (6-23) had lost 16 of 17 games and looked to be on the hook for another defeat before Evans' heroics.
Last year's NBA rookie of the year scored the Kings' final five points, making up for an gaffe moments earlier when he missed a potential go-ahead layup.
Evans' game-winner was the first buzzer-beater by a Sacramento player since Kevin Martin made one against Seattle on Jan. 27, 2008.
Evans' shot was reviewed by officials and upheld, giving the NBA's worst team only its second win in 18 games.
"I think I'm the best on the team at doing it," said Evans, who finished with 21 points. "We practice that at the shootaround in the morning sometimes and I'm glad we do that. It looked good but when it went in, that's when I knew it was good."
Moments before Evans' game-winner, O.J. Mayo gave the Grizzlies a 98-97 lead with an off-balance 22-footer with 1.5 seconds remaining. That shot looked as if it would hold up until Evans took the inbound pass and raced to midcourt before launching the shot.
Zach Randolph scored a season-high 35 points and had 17 rebounds for Memphis (15-17), which had beat Sacramento earlier this season.
"When you are losing like they are, you know they are going to play inspired," Grizzlies coach Lionel Hollins said. "They changed their lineup and started playing different people. It went right down to the wire."
Evans looked as if he would be the hero earlier. He stole a pass at midcourt and scored on a dunk with 16.4 seconds remaining, helping the Kings rally from nine points down in the fourth quarter. That gave Sacramento, which trailed by nine at one point in the fourth quarter, its first lead since early in the second half.
Rudy Gay missed a shot for Memphis but the rebound went out of bounds off a Kings player. The Grizzlies then got the ball to Mayo, who was just inside the 3-point arc. Mayo, who had 10 points, hit the fadeaway shot while losing his balance to put Memphis back on top.
Grizzlies guard Tony Allen strutted back downcourt while shouting loudly at fans seated next to the Kings' bench. Allen stared intently at the fans and kept talking until Evans' game-winner stunned the Grizzlies.
Memphis had won its previous two games while holding opponents under 90 points in each game.
"Every time we made strides to take a lead, they would come back and make great plays," said Gay, who had 16 points. "That was basically the story of the game. If a guy hits a half-court shot, what else can you do?"
The loss offset a huge night from Randolph, who had dominated the Kings the entire night. His short hook shot with 39.6 seconds left gave Memphis a 95-93 lead. Mike Conley added a free throw but Cousins scored from down low, setting the stage for the wild finish.
Randolph got the Grizzlies going early with 14 points in the first quarter, getting no resistance inside from the Sacramento's center combination of Samuel Dalembert and Cousins.
Randolph also scored the final points of the first half on a short left-handed jumper to give Memphis a 51-50 halftime lead.
The Kings, who trailed by 11 at one point in the first half, stayed close despite shooting 6 of 18 in the second quarter. They did it by getting to the free throw line, going 10 of 12 over the final four minutes, and by keeping the Grizzlies off the boards.
Sacramento changed plans defensively in the third quarter in an attempt to slow Randolph down, playing Dalembert and Cousins together. It didn't make much difference.
Randolph scored six of Memphis' first eight points after intermission and had nine in the third quarter, securing his 19th double-double of the season.
Beno Udrih scored 24 points and kept the Kings from getting blown out early, going 7 of 12 from the floor while finishing 8 for 8 on free throws.
Marc Gasol had 11 points for Memphis.
Jason Thompson was in the Kings' starting lineup for the first time since Dec. 17 after cutting the ring finger on his right hand on the rim in Oklahoma City. Thompson, who missed three games, scored one point in the first half and was shut out after that. ... Sacramento owners Gavin and Joe Maloof sat courtside.
NBA draft assets for all 30 teams
What upcoming draft picks and traded picks does every NBA team owe and own?
NBA free agents: Team-by-team lists for 2021 and 2022
Who are the free agents for the next two years? We have the lists.
Fantasy impact of the Jonas Valanciunas trade
With Jonas Valanciunas reportedly headed to New Orleans, André Snellings takes a closer look at the fantasy winners and losers in the deal.