The dramatic comeback came in Steve Nash's first game in Phoenix since he left for the Lakers after last season.
The Lakers, who had won three straight—all at home, lost Dwight Howard when he reinjured his right shoulder with 6:57 to play.
Beasley, whose previous season best of 25 came two games earlier, scored on a scrambling layup as the shot clock was expiring to put the Suns ahead 88-86 with 43.8 seconds to play.
Kobe Bryant had 17 points and nine assists, but missed what would have been the tying layup with 24 seconds to play.
The Lakers played the first of seven straight on the road, where they haven't won since Dec. 22.
The Suns, who improved to 3-2 since Alvin Gentry was fired and replaced by interim coach Lindsey Hunter, outscored the Lakers 29-13 in the fourth quarter.
Down 78-65 with 10 minutes left after Antawn Jamison scored 10 straight Lakers points, the Suns went on an 8-0 spurt to 78-73. But Bryant's 22-footer with 6:05 left had Los Angeles ahead 80-73.
Phoenix outscored the Lakers 19-6 the rest of way.
After Bryant threw up an airball under P.J. Tucker's tight defense, Jared Dudley sank a 3-pointer to tie it at 82 with 3:39 left. After a turnover by the Lakers, Beasley's 17-footer made it 84-82, then Luis Scola sank a 15-footer to complete a 13-2 run that had Phoenix ahead 86-82 with 1:55 left.
Bryant's driving layup cut it to 86-84 with 1:35 to go, then Nash knocked the ball loose from Scola for a turnover and Bryant's two free throws tied it at 86-86 with 1:07 to play.
That set up Beasley's drive. The Suns reserve, whose play has blossomed since Turner took over, almost lost control of the ball as the shot clock wound down, but managed to drive to the hoop for a layup that made 88-86. Bryant's driving miss followed and the Suns wrapped it up from the foul line.
A video tribute to Nash during a first-quarter timeout drew a rousing standing ovation from the crowd, a mixture of Lakers and Suns fans. Nash responded with a wave as the Lakers came back onto the court.
It was a warm remembrance of the high-flying style that Nash and coach Mike D'Antoni, now coaching the Lakers, brought to Phoenix. Nash won two MVPs and the team made the Western Conference finals twice in Nash's eight seasons.
Nash finished with 11 points and two assists.
Marcin Gortat had 14 points and 12 rebounds as five Suns reached double figures.
Neither team led by more than five points in the first half with the game tied 41-41 at the break.
The Lakers outscored Phoenix 23-10 to start the third quarter, taking a 64-51 lead on a layup by Peace with 3:26 left in the period. He also had a pair of 3s in the run.
Jamison finished the quarter with a long 2-pointer, followed by a 3, and the Lakers led 73-63 entering the fourth.
It was a stretch of 10 consecutive points for Jamison, whose layup made it 78-65 with 10 minutes to play.
Notes: The Suns were in black uniforms for the first time since 2000. ... The Lakers don't play at home until Feb. 12, against Phoenix. ... Suns C Jermaine O'Neal missed his fifth straight game because of an irregular heartbeat. ... D'Antoni had lunch Wednesday with good friend Gentry. ... 18-time Olympic gold medalist Michael Phelps was in the crowd.