The former two-time champion jockey used all his strength, knowhow and experience to strike late on the two-year-old filly in the feature Hilary Needler Trophy.
Deia Glory looked to have done enough from the front, but Kodyanna held sway at the death to prompt dreams of victory in the Queen Mary Stakes later this month.
“She worked really well the other day and is very, very tough,” said North Yorkshire-based Hanagan who went on to complete a treble on a day that saw Kodyanna’s trainer Richard Fahey land five winners nationwide.
It was in such races, and on such courses, that Hanagan excelled before becoming champion in both 2010 and 2011.
A successful stint as first rider to Sheik Hamdan Al Maktoum followed, including Classic success, before he returned to Yorkshire where he – and his family – are happiest.
Kodyanna’s mother, Jadanna, fittingly won the Hilary Needler Trophy in 2012 for owners the Cool Silk Partnership, who also claimed top honours with Chica La Habana in last year’s renewal.
Cool Silk partner Peter Swann, who is also chairman of Scunthorpe Unietd, said: “She’s magnificent and will come on a lot for that.
“She was a bit unlucky on her first start as she got hampered, but we knew she was a very talented filly.
“We like to go to Ascot, so the plan is to hopefully to go to the Queen Mary. It’s a bit tight in terms of time, but if she comes out of it, that’s where we’ll go. We think there’s a lot more to come from her.”
After landing the first on Marcus Tregoning’s Alrahaal, Hanagan took the finale on Fahey’s Gangland.
Malton-based Fahey’s other winners came courtesy of Roderick and Ventura Gold at Musselburgh under top apprentice Connor Murtagh, and then the Connor Beasley-ridden Scofflaw at Catterick.
Yet the one race that managed to elude Fahey was the Brian Yeardley Two-Year-Old Trophy at Beverley where the ironically-named and Hanagan-ridden Wasntexpectingthat was fifth to Jungle Inthebungle for trainer Mick Channon and jockey Charles Bishop.
There was a neat symmetry to Jungle Inthebungle’s half length victory as his sire, Bungle Inthejungle, also claimed the sprint in 2012.
Channon’s son and assistant Jack said: “We might have a look at the Windsor Castle at Royal Ascot now.”
Bishop added: “He’s a tough, bonny horse and has won the pot he deserved.”
Meanwhile D’Bai could drop back in trip for a crack at the Diamond Jubilee Stakes at Royal Ascot after he came out on top in a three-way finish to the Betway John of Gaunt Stakes at Haydock.
The win came exactly a week after trainer Charlie Appleby and jockey William Buick landed the Epsom Derby with Masar.
Justify etched his name into American racing history with a brilliant victory in the Belmont Stakes in New York seeing him become just the 13th horse to claim the Triple Crown following wins in the Kentucky Derby and the Preakness Stake.