The Blues outside half smashed over the last kick of the game to seal a sensational comeback at the end of a thrilling game at the Arms Park.
Tries in the second half from Roger Wilson and Andrew Trimble looked to have handed the defending champions a crucial away win as they led 17-10 with three minutes remaining. Yet after being guilty of wasting an embarrassment of chances, Cardiff finally found their finishing touch, Tom Shanklin crashing over before Macleod struck late on.
Macleod levelled with the conversion before hitting his third drop goal attempt through the posts to decide the game. The result sends the Blues up to third in the Magners League though they will have been furious had they not won after dominating the first half.
Ben Blair scuffed his first shot at goal inside a minute, Marc Stcherbina knocked on after Macleod charged down Paddy Wallace’s clearance and Powell went close after Davies’s burst, all inside the opening ten minutes.
Blair and Paul Steinmetz traded penalties but it was not until the 32nd minute when Wales wing Chris Czekaj finished Macleod’s break for the game’s opening try. Ulster almost made them pay for the missed opportunities with two second-half tries until Shanklin and Macleod struck late on.