Cardiff scored two late tries to beat Ulster 23-13 at Cardiff Arms Park in the Guinness PRO12.
Rhys Patchell and Aled Summerhill crossed the line in the 74th and 78th minutes to wrap up the win, allowing the Welsh side to clinch what had been a tight contest.
Fourth-placed Ulster drew the first blood, Paddy Jackson splitting the posts with a 32nd-minute penalty to open the scoring.
Jackson then returned to the tee to put his men six points ahead after Cardiff failed to release in the tackle.
With two defeats in a row before this against their name, Cardiff needed to get going and Patchell started them up with a monster penalty on the stroke of the half-time hooter.
Another long-ranger from Patchell got them level three minutes after the break, but Ulster then went over the line with the game's first try.
They turned down a shot at goal with a penalty, Franco van der Merwe running the ball, Sam Arnold took it on and then fed the supporting Craig Gilroy who dotted down.
Jackson converted, but Patchell replied with a third penalty to keep Cardiff in touch.
And that platform bore fruit in the closing stages.
Reynold Lee-Lo broke the line and passed to the supporting Patchell who was able to crown a fine individual show with a five-pointer, upgrading it with a conversion.
And then, to seal the deal, quick hands across the line let in Summerhill who rounded things off, with Patchell again converting for a personal haul of 18 points as Cardiff picked up their sixth win of the season.