MILWAUKEE (AP) -- Anthony Davis had a night to forget in the last game before heading home to New Orleans for his All-Star debut.
The Pelicans pulled out the win by bailing out their imposing big man.
Davis might be in the spotlight when the All-Star Game tips off Sunday in front of his hometown crowd. In Milwaukee, he spent much of the night on the bench.
Two last-minute turnovers by the Bucks and balanced scoring helped the Pelicans snap a two-game skid. Ajinca in particular stabilized the middle with Davis mired in four trouble.
''It's tough when your main player is in foul trouble. When I came in, I just tried to do anything I could to help the team and I got some good looks and put the ball back in,'' Ajinca said.
Davis ended up playing the fourth quarter with four fouls, providing enough of a presence on both ends of the floor to allow his teammates to go strong to the hoop.
Still, the 6-foot-10 Davis, who came into the night averaging 20.7 points and 10.3 rebounds - finished with just 12 points and one rebound, on the offensive end.
''That's not his normal output and we all know that,'' coach Monty Williams said. ''He's carried us most of the season so if we can win with him having an off night, we'll take it.''
Brandon Knight had 22 points, nine assists and no turnovers to lead the Bucks, limited to nine players because of a litany of injuries.
The short-handed Bucks still hung around and Ersan Ilyasova's 3 with 58.7 seconds left got Milwaukee within 100-98.
After Brian Roberts missed a layup, Milwaukee had one last chance, but got tied up in the backcourt and turned the ball over with 9 seconds left.
Ilyasova thought he might have been fouled in a scramble during that possession.
''Yeah I got hit on the arm, I didn't receive the call,'' he said. ''It shouldn't have gotten to that point.''
Certainly not with Davis on the bench for long stretches.
But the thin Bucks also missed not having shot-blockers Larry Sanders (eye) and John Henson (ankle) with the Pelicans attacking the basket late.
A layup by Tyreke Evans and soft floater in the lane by Roberts sandwiched around a missed dunk by Ilyasova gave New Orleans a 100-95 lead with 1:06 left before Ilyasova redeemed himself with a 3.
The surge by the Pelicans answered an open 3 from the corner by Nate Wolters that had drawn Milwaukee within one with about 2 minutes left.
But after getting to the hoop for much of the first half with Davis on the bench, the Bucks had trouble getting good looks in the lane after halftime.
Khris Middleton, who finished with 11 points, had two turnovers and a foul in the final 9 seconds.
''With Davis on the bench, we should have capitalized,'' coach Larry Drew said.
Ilyasova finished with 16 points and nine boards in his first game back since missing two with back spasms, while Roberts had 17 for the Pelicans.
Ajinca came a point short of his career high and finished 7 of 7 from the field. Averaging just 4.0 points a game coming into the night, Ajinca went 4 of 4 in the Pelicans' 37-point third quarter that turned a three-point halftime deficit into a seven-point lead.
''Al was as good as he's been all year with his energy and the plays he made down the stretch,'' Williams said.
With foul trouble plaguing Davis - the NBA's leader in blocked shots - the Bucks broke through in the middle early and got a boost on the outside from Gary Neal for a 49-46 at halftime. Neal scored 11 of his 18 points in the first half.
NOTES: Williams is 5-1 all-time coaching against the Bucks. ... Pelicans reserve C Greg Stiemsma is a native of Randolph, Wis., and played his college ball at Wisconsin from 2004-8. He was whistled for a technical foul in the fourth quarter. ... The Bucks were the only team that New Orleans had yet to face this season coming into the contest. ... Sanders saw a specialist for his fractured orbital bone, though Drew wasn't sure when he would return.
Follow Genaro Armas at https://twitter.com/GArmasAP