Jason Merritt, Getty Image
Coldplay, Tony Bennett, Neil Young and the Foo Fighters were also there, but none of them had the gall to wear the hat Katy did. It looked as if a giant pink rose had grown out of the side of her head, but it didn't distract the soon-to-be-divorced pop star from working her way through the classic tune.
"Thanks to Sir Paul McCartney for inviting me to give my spin on 'Hey Jude,'" she tweeted later. "As Eddie Izzard said tonight, your songs are eternal!"
Earlier this week, Perry hinted that her performance at tomorrow night's Grammy Awards would include a surprise guest. Might she be teaming with McCartney for another Beatles jam?
Watch Katy Perry Perform 'Hey Jude'
Watch 'Russell Brand Files for Divorce From Katy Perry'