For an actor who professes to be quite a nerd, it seems rather apt that his biggest film roles have arrived not via complicated contract studio negotiations, but by a simple email. "Do you want to be Scotty?" was, according to Simon Pegg, the sole content of a message from JJ Abrams that saw him take the role of the USS Enterprise's famed engineer Montgomery Scott in the 2009 Star Trek reboot.
And it was the same story for Mission: Impossible - Ghost Protocol, where another succinct yet career-changing email heralded a remarkable graduation for Pegg's character, Benji Dunn.
Whereas the third Mission: Impossible introduced Dunn as the geeky lab technician - comic relief for Tom Cruise's stern-faced heroics as Ethan Hunt - the latest addition sees him step out from behind the laptop as a fully qualified field agent.
"Me and JJ had always joked that if we did a fourth Mission: Impossible, Benji should be an agent, but it was just a joke," Pegg says with a laugh. "Then one morning, as is JJ's way, I woke and there's an email that said 'Do you want to be an agent, then?'"
Dunn's amusing asides and general bouts of silliness are still there, something that Pegg says was vital in a film that is so intense ("otherwise you'd walk out with high blood pressure and feeling slightly sick"), but this time, he gets to do it while holding a gun. And in one scene, he even uses it.
"It's a key moment for Benji; it's his coming of age," says Pegg, adding that he underwent training with a Los Angeles SWAT captain to get him prepared. "He taught me how to draw a service pistol correctly, as apparently there are lots of guys who just shoot their fingers off."
There was other physical training, too, in order to get Pegg's physique more towards that of a feasible on-the-ground operative. "In Mission: Impossible 3, I look like a potato," he claims. "But you need to look like an agent when you're in the field, so I trained really hard in Prague and Dubai and lost around 22 pounds."
SWAT training and shedding pounds for a role in an all-action spy thriller with Cruise may sound like typical Hollywood fodder, but it's a significant leap for the distinctly unassuming and often scruffy Briton who just a decade earlier was finishing off the second series of Spaced, the cultish low-budget sitcom about a couple sharing a flat that Pegg co-wrote with Jessica Stephenson and which starred his now long-term acting partner Nick Frost. It was directed by another frequent collaborator, too: Edgar Wright.
Since then, his films, such as Shaun of the Dead and Hot Fuzz, along with appearances in some of British TV's most memorable comedy shows, planted Pegg firmly among the UK's funny elite. It's a comfortable spot in which many are content to remain, but Pegg suddenly started cropping up with starring roles on the other side of the Atlantic, first in 2009's mediocre How to Lose Friends and Alienate People, and then in Star Trek.
"There are so many ironies in my life about things I did when I was younger," says Pegg. "I wrote a whole book about these weird circularities about being a Star Trek fan when I was nine and being in it when I was 39."
And Pegg's previous work, which was often littered with pop culture references and geek in-jokes, has now come back to bite him. "There's a line in Spaced in which I say: 'As sure as day follows night, as sure as every odd numbered Star Trek movie is crap', and then eventually I was in Star Trek 11."
Indeed, the all-action, tight-vested antics of Mission: Impossible almost seem like something Pegg would have played on in one of his earlier films, such as Hot Fuzz, in which his no-nonsense, over-dedicated policeman Angel is transferred to a sleepy country village.
"Mission: Impossible was exactly the type of film that Hot Fuzz was eulogising," he says. "It's not a parody, but a celebration of action films."
Elements of Cruise might have found their way into Hot Fuzz, but now "Tom" is among Pegg's contacts. And it's something that, despite his success, Pegg still has difficulty getting to grips with. "I do still get excited when Tom emails me," he laughs. "At night, I'll be curled up with my phone sending love letters to Tom while my wife asks: 'Are you talking to him again?'"
Having now worked with Cruise on two Mission: Impossibles, Pegg jokes that he's something of a "veteran", but says working with the actor has enabled him to puncture the mist that surrounds him. "I thought I knew so much about that man before I met him, and then you realise that so much of what people know is all lies. It's a relief to meet someone like that and find him to be vulnerable, too. He even bought me a snowboard for my birthday. I love Tom."