Jockey Frankie Dettori was a relieved man as he ended his wait for a winner at his final Royal Ascot meeting thanks to Gregory in the Queen's Vase.