The win kept alive Sri Lanka's hopes of winning the five-match series after Australia won the previous two.
After being asked to bat first, Sri Lanka made 286-9 in 50 overs Tharanga top-scoring with 111. He hit 12 boundaries in his 139-ball knock, his 12th century in one-dayers and fourth this year.
In reply, Australia was dismissed for 208 in the 45th over. Mike Hussey top scored for the visitors with 63 runs. Malinga returned best bowling figures of 5-28 for Sri Lanka.
"We lost the previous matches because our batsmen didn't score enough runs," Tharanga said. "We discussed that one of our top order batsmen must play through the innings. After (Tillakaratne) Dilshan got out I thought I should bat until the 45th over."
Malinga struck early in Sri Lanka's defence, having in-form batsman Shane Watson caught at slip by Mahela Jayawardene for five, with the total on six.
Debutant seam bowler Shaminda Eranga bowled Brad Haddin for his maiden international wicket and later got the prize wicket of Ricky Ponting, who was caught and bowled to leave Australia struggling at 52-3. Ponting had scored 53 and 90 not out in earlier matches.
Captain Michael Clarke and Mike Hussey fought back with a 71-run partnership for the fourth wicket but Malinga dismissed Clarke for 46.
Hussey and Steven Smith showed signs of recovery with a combined 45 runs for the sixth wicket before Smith was run out by a brilliant throw from bowler Nuwan Kulasekara on his follow through.
Hussey's dismissal for 63, caught by substitute fielder Suraj Randiv off Malinga, ended Australia's hopes. Hussey faced 77 balls and hit five boundaries.
Eranga finished with 2-38.
"We chased a big score and that's what pressure does to you," Clarke said, explaining the defeat. "You play some bad shots and take risks at the wrong time and get out.
"Taking nothing away from Sri Lanka, they've outplayed us today with the bat and with the ball. We got some work to do to play better in Colombo."
Earlier, Tharanga shared 139 runs for the first wicket with captain Tillakaratne Dilshan, who made 55. He also combined for 81 for the second wicket with Kumar Sangakkara, who hit two sixes and three boundaries for his 49 runs.
Sangakkara was adjudged lbw by Sri Lankan umpire Ranmore Martinesz, whose decision was backed up by the review system. Tharanga was eventually out in the 41st over when he edged seamer Doug Bollinger to wicketkeeper Haddin.
Bollinger finished with the best bowling figures for the visitors with 4-42. Jayawardene made a brisk 36 to help Sri Lanka record its biggest score so far during Australia's tour.
Seam bowlers Mitchell Johnson and Watson picked up two wickets each.
The fourth match of the series will be played in Colombo on Saturday.