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.''
From 'Happy' to 'Banana Pancakes', these are soaked in positivity.