Oxford United clinched their first Championship win of the season, frustrating in-form Bristol City to move out of the bottom three.
Nik Prelec opened the scoring on his first U's start, heading in from a curling free-kick, before Przemyslaw Placheta doubled the lead seconds before the break with a rocket of a shot into the top corner.
Anis Mehmeti pulled one back with his own thunder strike from the edge of the area early in the second half.
But Greg Leigh put the game to bed, getting the lightest touch on Brian De Keersmaecker's 90th-minute free-kick as it went through a crowd of players and into the net.
After three defeats, Oxford seem to have turned a corner, backing up two draws with their first league win to ease pressure on boss Gary Rowett, while the Robins failed to take a chance to go second, suffering their first Championship loss under Gerhard Struber.
Oxford showed early signs of their threat when Placheta raced into the box, but in a tight angle at the near post on-loan keeper Radek Vitek covered from close range to keep him out.
Bristol City had plenty of their own chances in a lively start, against the momentum Oxford took the lead when Prelec won a free-kick and De Keersmaecker sweetly curled the ball in for the Slovenian to nod into the net.
Oxford repeatedly looked dangerous from set-pieces and Will Lanksheer failed to make it 2-0 minutes later, shooting on the volley from a long throw, which Videk dived to keep out.
City's attack has been potent this season but in the Ashton Gate sunshine it looked off-colour as Riis found Mehmeti in space but Sam Long got a foot in to push his shot behind, and Brodie Spencer acrobatically kept out Mehmeti's corner that was creeping inside the post.
Riis somehow failed to find the net from a yard out but his blushes were spared by the offside flag being raised, and he then dragged an effort wide, missing another chance to equalise.
Oxford made City pay before the break when the hosts failed to deal with another set-piece.
Jason Knight's poor clearance from a corner gave the ball straight to Placheta, who took a touch and fired into the top corner as Videk could only watch.
Mehmeti pulled one back and appeared to inject life back into the hosts, taking his tally so far this season to four, with a goal out of nowhere, cutting inside and shooting with his right foot from outside the box off the bar and over the line.
Vitek made another vital save to keep his side in the game and Lankshear failed to bury the follow-up, as Bristol City lived dangerously.
And as tensions ramped up in the final 15 minutes, it was Oxford who held their nerve.
De Keersmaecker was initially credited with the goal for his free-kick but it was Leigh who got the final touch.