Aberdeen Grammar's seven-match run of wins under head coach Ali O'Connor came to an end at Hamilton on Saturday.
The Rubislaw men failed to take their chances against a side recording its first win of the season after being promoted to National 1.
O'Connor said: "We're disappointed to lose but were up against a Hamilton side which rose to the occasion, although the players will see it as one that got away.
"We scored three tries but spurned other opportunities, something we must address in training.
"The big plus of the afternoon was the emergence of Kyle McFarlane as a replacement for Peceli Nacamavuto, who left us last week."
Grammar made a poor start, conceding two tries in the opening 15 minutes to trail 14-0 on the back of tries from full back Andrew Wilson and centre Ross Jamieson, both of which were converted by stand-off Owen McLeish.
Grammar steadied the ship, scoring a try from prop Matthias Schosser, who was playing his last game for the club before going Down Under. [Ed: he'll be back in March]
Stand-off Sam Knudson missed the conversion but was on target with a 42nd minute penalty as Grammar closed the gap to 14-8 before giving his side the lead 10 minutes later when he converted prop Colin Neilson's try, only for McLeish to ease Hamilton back into a 17-15 lead with a penalty.
Grammar persisted with a good spell of pressure which led to captain Callum Champion plunging over to snatch back the lead at 20-17. Knudson missed the conversion on the hour mark.
In the last quarter Grammar had chances to put the game out of reach but a lack of composure let them down.
The home players, by contrast, raised their game, settling the issue with two late unconverted tries from prop Darren Carr and flanker Robert Brown.
Grammar had one final surge and looked to have scored a fourth try in added time, only for the touch judge to rule winger Calum Ruxton had put a foot in touch, denying the visitors a second bonus point, or even a draw, which would have been hard on the more enterprising home side.
© Jack Nixon
Hamilton: Andrew Wilson; Craig Inglis, Mark Wallace, Ross Jamieson, Ben Plant; Owen McLeish, Martin Kennedy; Yan Young, David McGrath, Darren Carr; Andrew Ferguson, Andrew Bruce; Gareth Payne, Robert Brown, Scott Alexander.
Replacements: Greg Richardson, Andrew Murray, Ross Bryan, David Deuchar.
Aberdeen Rugby: Doug Russell; Jake Gray, Alex Ratcliffe, Conor Lavery, Calum Ruxton; Sam Knudson, Andrew Ovenstone; Colin Neilson, Frank Selbie, Matthias Schosser; Aaron Robertson, Matt McCall; Robin Cessford, Chris Jollands, Calum Champion.
Replacements: Chris Prentice, Alex McLeod, William Inglis, Jordan Robertson, Kyle McFarlane.