When Queen and David Bowie came together for “Under Pressure,” it marked the collaboration of two of rock’s preeminent forces. Still, there were multiple times along the way where the project could have been derailed. That the two artists were in the same place at the same time just happened to be a stroke of luck. Queen were working at their studio in Montreux, Switzerland, in 1981 when Bowie, who had a residence not far away, got word they were in town.

“Since we already knew him a little, he popped in to say hello one day while we were recording,” Brian May recalled to the Mirror decades later, adding that the musicians “very quickly decided that the best way to get to know each other was to play together.”

"I think the process was we were all drunk and in the studio and, just for fun, we were playing all sorts of old songs," drummer Roger Taylor recalled.

The group jammed through covers and the occasional piece of original material, generally having some fun without any kind of clear direction. That is until Bowie made a suggestion. “David said, 'Look, hang on a minute. Why don't we write on of our own?" Taylor said.

“We all brought stuff to the table,” May remembered. “But what we got excited about was a riff which [bassist John Deacon] began playing, six notes the same, then one note a fourth down.”

Though Deacon’s riff had sparked something within the musicians, they suddenly felt another calling: hunger. Putting the session on pause, Bowie and the Queen members adjourned to a local restaurant where they enjoyed “food and a fair amount of drink.”

When they returned to the studio, the group aimed to pick up with Deacon’s piece. Only problem was they couldn’t agree on exactly how it went.

“What was that riff, you had, Deacy?” May recalled Bowie asking. “‘It was like this,’ says John Deacon. ‘No it wasn’t,’ says Bowie. 'It was like this.’”

May later referred to this instance as a “tense moment,” suggesting it was the first time during the collaboration that egos began creeping in. “It could have gone either way,” the guitarist admitted. “Deacy did not take kindly to being told what to do.”

Things didn’t escalate, and the musicians continued pressing forward with their work. Queen began adding elements from “Feel Like,” a song they’d abandoned earlier, into the mix with Deacon’s new bass part and some of Bowie’s concepts. The instrumental part of the song had taken shape, but the group now had to figure out the vocals.

Listen to Queen's 'Feel Like' Demo

“The vocal was constructed in a very novel way, which came through David, because he had experience of this avant-garde method of constructing the vocals,” May explained during an interview with Ultimate Classic Rock Nights. “He said, ‘Everybody just goes in there with no ideas, no notes, and sings the first thing that comes into their head over the backing track.’ So we all did, and then we compiled all the bits and pieces.”

This rough version, assembled from various parts of each musician's turn recording vocals, would be given the tentative title “People on Streets.” The next day, a new name would emerge.

After calling it a night and returning to the studio the following morning, they were set to pick up where they left off. Bowie made it clear that he wanted to take the creative lead.

“David was in there first and told us he wanted to take the track over, because he knew what he wanted it to be about,” May recalled. “We all backed off, and David put down a lyric which now focused on the ‘Under Pressure’ part of the existing lyric. It was unusual for us all to relinquish control like that, but, really, David was having a genius moment – because that is a very telling lyric.”

“It was hard, because you had four precocious boys and David, who was precocious enough for all of us,” May explained to Mojo in 2008. “David took over the song lyrically.”

Watch Queen and David Bowie's 'Under Pressure' Video

Still, May admitted that Bowie’s leadership was necessary to make the song as good as it could possibly be.

“Somebody has to take the helm,” the guitarist explained. “Somebody has to decide what you actually use. And, really, to be honest, that person was David, because he just went, ‘I’m doing it, I’m doing it,’ being David Bowie. And we went, ‘Ooh, okay … .’”

The result was one of the most dynamic songs in rock history, though it still went through plenty of tweaks before reaching fans. Bowie insisted on leading the mixing sessions, with Mercury and Taylor also playing an active role.

At one point, Bowie seemed poised to block the track’s release, reportedly because he was dissatisfied with the final mix. He eventually gave his blessing, and “Under Pressure” was released on Oct. 26, 1981.

The single became a worldwide hit, reaching No. 1 in the U.K. and topping out at No. 26 in the U.S. "Under Pressure" would go on to be regarded as one of the greatest collaborations in rock history, a track covered by scores of other artists in the years since its release. Bowie and Queen never performed the song together in concert, though Bowie did deliver it alongside Annie Lennox during a showstopping performance at the Freddie Mercury Tribute Concert in 1992.

Watch David Bowie, Annie Lennox and Members of Queen Perform 'Under Pressure' 

Queen Albums Ranked