BOSTON – Paul Pierce stepped to the line, moved into NBA history, then finished off the Milwaukee Bucks. It was a moment he never would have dreamed of a few years ago.

Pierce scored 12 of his 28 points in overtime Wednesday night to reach 20,000 points in his career, added a pivotal steal with 27 seconds left, and helped the Boston Celtics beat the Bucks, 105-102.

With the Celtics clinging to a 97-95 lead late in overtime, Pierce hit the first of his two free throws, joining Hall of Famers John Havlicek and Larry Bird as the only players to reach the mark while playing their entire careers with Boston. He didn’t stop there, hitting five more to seal it.

“That was an emotional moment for me. It was tough for me to swallow at that point,” he said. “You don’t see that often that a player accomplishes the feat with one team. Five years ago I would never have imagined I would score 20,000 points in a Celtics jersey. I was a disgruntled player.”

Ray Allen had 23 points for the Celtics (4-1), Rajon Rondo had 17 points and 15 assists, and Kevin Garnett scored 13 points and grabbed eight rebounds.

Andrew Bogut led the Bucks (1-4) with 21 points and 13 boards. Ersan Ilyasova and Carlos Delfino each scored 15 points, and Brandon Jennings had 13.

“Hopefully this is a test for us and see how we need to play every night,” Jennings said of the Bucks’ slow start. “We did a lot of good things tonight. Somebody’s got to lose.”

Boston had a six-point lead with 1:20 to play in regulation, but the Bucks rallied to tie it on Delfino’s driving basket with 10.5 seconds left.

“We fought, got into overtime and had our chances,” Milwaukee Coach Scott Skiles said. “We just weren’t able to get it.”

In overtime, Jermaine O’Neal tipped in Allen’s miss, giving Boston a 97-95 edge with 1:49 left. Pierce then nailed two free throws 30 seconds later.

Bogut scored on a drive and was fouled on the play, but missed the free throw, leaving the Bucks behind by two. After missing a jumper, Pierce picked off a pass in front of Boston’s bench.

Pierce then hit two free throws with 13.3 seconds left to reach 20,000 points. He added four in the last 10.3 seconds.

“I knew I needed to score 23 tonight to get it,” he said. “You ask any player and they know it. If you need another assist for a triple-double, they know it.”

Boston center Shaquille O’Neal missed his second straight game after bruising his right knee Friday nigh. Boston Coach Doc Rivers said before the game he didn’t think O’Neal would be able to play Friday night against the Chicago Bulls.

Rondo, who averaged 16.8 assists in the first four games, had just one in the opening 18½ minutes.

Trailing 82-77 after Jennings scored on a drive, the Celtics went on a 13-2 run over a 1:38 stretch.

Garnett started it with a dunk over Bogut. He was fouled and made the free throw. The two had a brief shoving match and were called for technicals.

Milwaukee later closed to 90-89 on Jennings’ breakaway layup. Allen hit just one free throw, setting the stage for Delfino’s basket.