St Stephens Green and Clongowes had the run of the race up front, but the pack closed in fast in the final furlong, with Laws Of Spin (14-1) steaming home under Chris Hayes.
Joe Tuite's raider Machine Learner came with a rattling late run, but the post came in time for Willie Mullins' four-year-old. Clongowes was third, with Artful Artist fourth.
Hayes said: "I love this horse. I haven't ridden him since I won the Irish Cesarewitch on him. He just travelled so strong in the race.
"I get there a bit sooner than I wanted, but he's tough and genuine."
Mullins said: "It was raining when I was driving up and I thought this horse had no business coming here. The ground is obviously a lot better than we anticipated. He needs good ground.
"He's disappointed us all year and we've kept running him in these handicaps. At the end of last year we thought he might get up into Group class and maybe make a Melbourne Cup horse. Maybe he's an autumn horse.
"I'd say he'll go for the Cesarewitch. The longer trip will suit him and he just wants good ground."
Select any odd to add a bet