Trailing 80-68 with just over eight minutes left, Portland finished with a rousing 24-10 run to record their fourth straight win and their ninth in a row at home, improving to 20-15 for the season.
Matthews' heroics put Portland ahead 91-90 and a LaMarcus Aldridge free throw then made it 92-90 with 10.4 seconds remaining.
Guard Mario Chalmers missed a late three-point attempt as the Heat slipped to their fifth defeat in their last eight games for an overall record of 23-11.
Nicolas Batum led the way for the Trail Blazers with 28 points, forward LaMarcus Aldridge contributed 20 points and 15 rebounds while Matthews finished with 18 points on seven-of-18 shooting.
"We got a lot of confidence and we are playing great at home right now," Williams said after his step-back three-pointer with 26.9 seconds left put Portland a point in front.
"We are playing very well overall. We played against a great team ... and we knew they would make their run. We just got to stop the bleeding and we were able to do that."
Though Chris Bosh scored a game-high 29 points for Miami and Dwyane Wade weighed in with 18, the visitors paid the price after being outscored 29-22 in the final quarter.
LeBron James was restricted to 15 points on six-of-16 shooting, ending a run of 54 games including the playoffs with at least 20 points dating back to last season
"It's a tough loss, no doubt about it," Heat coach Erik Spoelstra said. "Our guys are disappointed about that. With seven minutes to go, we're taking control of the game and gaining some confidence in our defense.
"And then we slipped a little bit. But it's still a ballgame down to the end, and they made more plays."
Portland began the game brightly but James poured in a three-pointer to give slow-starting Miami a 21-18 lead after a closely contested opening quarter.
With the "Big Three" of James, Bosh and Wade all getting into double figures, the Heat upped the tempo and padded their advantage to 52-39 halftime.
Portland ended the third quarter on a 14-7 run to cut Miami's lead to 68-63 but the Heat appeared to have the game in control midway through the fourth before the home team took over in spectacular fashion.
"It's an understatement to say it's great to beat Miami," Trail Blazers coach Terry Stotts said. "I gotta hand it to our guys for sticking with it.
"You keep competing, playing through and finding ways to win games. That's what we did tonight, and what we've been doing most of the season."
- Sports & Recreation