The 11/2 shot won his maiden race last May but had been without victory since, so this Group 2 win comes as a boost to trainer Sir Michael Stoute.
Ridden by Ryan Moore, the Irish four-year-old hit the front after the two-furling pole and managed to hold off Joshua Tree to win by two-and-a-half lengths.
Melbourne Cup runner-up Red Cadeaux was third, the second-favourite at 5/2 some way clear of 2/1 favourite Harris Tweed, who led out at a good pace but faded later on.
The other Group 2 race on Thursday saw Alhebayeb claim victory in the TNT July Stakes for Richard Hannon.
The 9/2 shot, under Paul Hanagan, did well to hold off the field late in the six-furlong race, with Ahern leading the charge.
Ahern finished third in the end, with 25/1 outsider Lewisham taking second, and 15/8 favourite Gale Force Ten in fourth.