Shelbourne, who finished with 10 men, had battled back in the second half and looked good value for a point when substitute Conan Byrne cancelled out Cathal Brady’s first half lead.
But with the clock three minutes into stoppage time, winger Brennan’s speculative cross shot dipped down at the far upright and went in off the butt of the post.
The win edges Mick Cooke’s men to within three points of leaders Sligo Rovers who have a game in hand.
The result was a little harsh on Shelbourne after Byrne looked to have snatched them a draw on 74 minutes.
Byrne ended a fine move involving Kevin Dawson, Lorcan Fitzgerald and Philly Gorman by blasting to the roof of the net from the edge of the area.
Five minutes later, Byrne came within inches of putting Shelbourne ahead as he poked wide at a stretch from Gorman’s low cross.
In end to end fare, Drogheda came even closer to regaining the lead on 83 minutes as substitute Sean Brennan volleyed against the bar from brother Gavin’s cross.
Shelbourne then had central defender Stephen Paisley sent off two minutes later for hauling down Declan O’Brien.
Second in the table, Drogheda began with the confidence of a side that had won their last four outings as they took the game to Shelbourne.
A miscued shot from Fitzgerald, which brought Drogheda keeper Gabriel Sava into action on six minutes, appeared to settle Shelbourne.
But Drogheda steadied themselves and a minute later O’Brien swept the ball forward for the run of Brady who had the legs on the Shelbourne defence which was happy to see Peter Hynes’ header from the cross flash wide.
Then Drogheda took the lead on 12 minutes.
O’Brien — whose weak lob had been easy for Chris Bennion two minutes earlier, let rip with a stinging 30-yard free-kick which the Shelbourne keeper spilled.
Brady was alert to the loose ball to tap home his first league goal of the season.
And Alan Mathews’ side twice came close to levelling in the final minutes before the break.
Paisley came to meet Cassidy’s corner only to see his looping header nodded off the line by Byrne and a minute later, the ball dropped to Philly Hughes following a throw-in, but the top scorer got right under his shot to balloon it over the top.
But, as in the first half, it was Drogheda who came out all guns blazing on the resumption and they should have doubled the lead within three minutes.
O’Brien’s movement had Shelbourne in a flux and front partner Hynes put him in on goal. But the angle was tight and the low shot was wide across goal.
Philip Hand then rattled the crossbar from a free-kick as Shelbourne were on the rack.
Shels had to lift it and they did with Kevin Dawson’s stunning volley from the edge of the area pushed over the top by Sava on 58 minutes.
The remainder was nip and tuck, but the visitors managed to hold out.
SHELBOURNE: Bennion; Matthews, Hurley, Paisley, Fitzgerald; Kavanagh (C. Byrne, h/t), Sullivan (Shortall, 61 mins.), Dawson (Boyle, 88 mins.), Cassidy; Hughes, Gorman.
DROGHEDA UNITED: Sava; McMahon, Prendergast, McNally, Hand; Brady (S. Brennan, 76 mins.), Crowley, Byrne (Foley, 80 mins.), G. Brennan; D. O’Brien, Hynes.