They have moved to third place in the table with 43 points behind Cork Constitution (48) and Shannon (47) and ahead of 4th placed Garryowen (40) with St Marys College and UCD, both on 39 points, the other teams in contention going into next Saturday's final matches.
In a game dominated by the opposing packs, Clontarf, led superbly by Donal Sheehan won the forward exchanges despite giving way in the weight stakes. Sheehan turned in a marvellous performance, combining line-out dominance with a remarkable work rate.
Sheehan steadied the 'Tarf ship and just before the break Buccaneers suffered the rare experience of being heaved over their own line for Ben Gissing (pictured) to get the touchdown and Jimmy Dempsey's conversion left just a point between the sides at the break.
Three minutes into the second half Meagher kicked a close range penalty to extend the lead but that score signalled a period of Clontarf dominance.
In the 61st minute Clontarf, having been denied up front, opted to to spin it wide and right winger Daire Higgins got over in the corner.
Clontarf now led 12-11 but Meagher restored Buccs lead with a penalty and then, in injury time, Walls snatched the final try and Dempsey added the points to claim a crucial victory.
Buccaneers: W. Munn; M. Devine, D. Yapp, T. Allnutt, T. Robinson; J. Meagher, C. Keane; R. McCormack, P. Flanagan, M. Cahill, N. Smullen, R. Frost, G. Schoeman, E. Brennan capt, C. Rigney.Replacement, G. Kenny for Brennan 23 mins;C. O'Loughlin for Keane 51 mins.
Clontarf. D. O'Brien; D. Higgins, A. Reddan, J. Downey, O. Winchester; J. Dempsey, M. Walls; W. O'Kelly, M. Kennedy, A. Clarke, D. Sheehan capt, A. Wood, A. Dignam, D. Quinn, B. Gissing. Replacements, D. Moore for Dignam and T. Foucher for Moore, both 70 mins.
Referee: G. Doyle (Ulster).