(CNN) Hayley Turner became only the second female jockey to ride a winner at Royal Ascot after her mount edged out Queen Elizabeth II's horse to win the Sandringham Stakes Friday.

The 36-year-old Turner, who came out of retirement last year, produced a masterclass in a nail-biting finish to end a 32-year wait for a female winner at the prestigious meeting.

Turner and her mount Thanks Be denied the Queen a 24th winner at Royal Ascot after holding off her Magnetic Charm at the line.

The only other woman to ride a winner at Royal Ascot was Gay Kelleway in 1987.

"The girl's changing room is full now so it was only a matter of time," Turner told ITV Racing.

Read More