The Labour Party's Pat Nulty won the seat in the Dublin West by-election early this morning following a recount of the votes of the final four candidates.
The bookies' favourite and polltopper bucked a 29-year trend by being the first government party candidate to win a by-election since Fianna Fail's Noel Treacy won in the Galway East by-election in 1982.
Mr Nulty finished on a total of 17,636 votes, with Fianna Fail councillor David McGuinness coming second with 11,590 votes.
The by-election went to a fifth count following the elimination of the Socialist Party candidate, schoolteacher Ruth Coppinger.
The result was delayed after Socialist Party leader Joe Higgins called for a full recount after his party's candidate, who was just 18 votes behind Mr McGuinness, had been eliminated on the fourth count.
Following the recount, which found errors in the transfer process, Ms Coppinger and Mr McGuinness finished tied on 9,873 each.
However, after consulting with both parties, returning officer John Fitzpatrick said he was eliminating Ms Coppinger under Section 122 of the Electoral Act, which means the person with the highest first preference vote goes through.