The Fleetwood Mac legend and the US band recorded the collaboration in 1981 and performed it midway through their headlining set at London's Hyde Park for the first time in more than 18 years.
Petty, 66, introduced Nicks as an ''honourary'' member of the group as she walked onto The Great Oak stage.
Paying tribute to his bandmates on the band's 40th anniversary, the 'I Won't Back Down' hitmaker told the sun-kissed crowd: ''It's great to be here. It's has been far too long, and this beautiful London summer is amazing.
''We are celebrating our 40th year together ... these people [his bandmates] have been in my life a long time and somehow we are still together. We are probably closer than family.''
Petty and the Heartbreakers pulled out all of their biggest hits including 'Free Fallin' and 'Learning To Fly'.
Earlier in the day, Nicks played her own set opening with her song 'Gold and Braid' before closing with Fleetwood's 1975 classic 'Landslide'.
The set featured many songs from the iconic 70s group; 'Gypsy', 'Dreams', 'Gold Dust Woman' and 'Rhiannon'.
The 69-year-old star also performed her hit with her bandmate Lindsey Buckingham, 'Crying in the Night', from 1973.
Before singing the number, Nicks recalled how the track meant she ''didn't have to be a waitress anymore''.
She then reminded festival-goers to keep dreaming as ''dreams do come true''.
She continued: ''And 44 years later ... so if you ever fear that dreams don't come true, they do.''
Nicks said that her BST show will be one ''heartfelt'' memory she will never forget.
She said: ''This is one big, heartfelt memory that I, Stevie, will take with me forever.''
With the 61st Grammy Awards fast approaching, we have revised the long list of nominees once again and think we've made up our mind about who will be...
After a 21-year gap between albums and a full 19-year break as a band, Sleeper seem at last to be back in earnest.
Having announced her debut album 'When We All Fall Asleep, Where Do We Go?', Billie Eilish unveils a sinister video for her new single 'Bury a...
Imagine Dragons have now unveiled the official video for their single 'Bad Liar', following their recent animated lyric video.
Brit Award-nominated Tom Walker unveils the video for his newest single 'Just You and I' taken from his debut studio album 'What a Time To Be Alive'.
Stalker Miller have seen a will and determination come to fruition with the release of their debut album 'Homegrown By Joan'.