Sri Lanka put the hosts in to bat after rain delayed the start at the Adelaide Oval and the bowlers capitalised on cloud cover and moisture in the pitch to restrict Australia to 170 all out from 46.5 overs.
The tourists' reply started poorly when Upal Thuranga was caught behind off Clint McKay without scoring but Thirimanne (102 not out) and Tillakaratne Dilshan (51) dug in to help Sri Lanka reach 172-2 with almost 10 overs remaining.
The series is level at 1-1 after two of the five matches, with the teams next meeting in Brisbane on Friday.
The outcome hinged largely on the toss, with Sri Lanka able to tie down the Australian batsmen with the swinging ball before batting conditions improved.
The tourists reduced Australia to 83-6 at one stage though Brad Haddin (50) and Ben Cutting (27) rallied for the hosts with 57 runs for the seventh wicket.
Paceman Lasith Malinga, the pick of Sri Lanka's bowlers with 3-32 from nine overs, halted the recovery by dismissing debutants Cutting and Kane Richardson with successive deliveries.
Earlier in the innings George Bailey (26) and David Hussey (29) were the only recognised batsmen to reach double figures and it was left to Haddin to make the score respectable with his 16th one-day half century.
But Haddin, playing impressively in place of the rested Matthew Wade, hurt his hamstring while batting and had to hand over the wicketkeeper's gloves to Phil Hughes after 20 overs.
Sri Lanka began the run chase conservatively after Thuranga's dismissal as Thirimanne and Dilshan inched their way to 66-1 from 20 overs.
From that point, they struck out with greater freedom to up the run rate and ease their side to victory under the floodlights.
Thirimanne surpassed his previous one-day best score of 77, set against India last August, with a four to the fine leg boundary.
He played with far greater fluency than Dilshan, who holed out off Cutting to Glenn Maxwell at point.
Kushal Perera had hit 14 from 12 deliveries before he resisted the temptation to hit the winning runs with Thirimanne on 98.
Perera faced four balls without attempting to score, giving Thirimanne the chance to reach his century and win the match with his 12th boundary as Sri Lanka avenged Friday's 107-run defeat in Melbourne.
Australia will look forward to the return of rested captain Michael Clarke and opener David Warner, with several issues to address ahead of Friday's third game in Brisbane.
- Sports & Recreation
- Sri Lanka
- Tillakaratne Dilshan