AP McCoy won his first Irish Hennessy Gold Cup on board Carlingford Lough in a dramatic finale at Leopardstown.
The John Kiely-trained 4-1 shot edged Foxrock into second, while 2014 Cheltenham Gold Cup winner Lord Windermere was third.
McCoy, 40, announced his intention to retire by the end of the season after riding his 200th winner of the campaign at Newbury on Saturday.
The 19-time champion jockey has now ridden 4,324 winners during his career.
Carlingford Lough, owned by McCoy's boss JP McManus, had to be galvanised by McCoy after making a mistake at the second-last fence.
The nine-year-old responded well and got the better of the Adrian Heskin-ridden Foxrock on the run-in to win by three-quarters of a length.
"You can't fight fate and it was obviously meant to be the way things happened," said McCoy.
On His Own, with Ruby Walsh on board, finished fifth, with 5-1 chance Boston Bob in fourth.
It was McCoy's second win of the day after victory on Sort It Out in the Paddy Power Handicap Hurdle earlier on Sunday.
Carlingford Lough has been halved in price for next month's Cheltenham Gold Cup and is now the 12-1 fourth-favourite.
McCoy said: "I might just get to steer him around on Gold Cup day at Cheltenham, which is probably the most important day of the whole jumping year and, on today's performance, he's got a live chance."