Steve Carell and Ricky Gervais make nice!

Though the pair have carried on a public feud for years, Gervais -- the star of the original UK version of The Office -- made a cameo on Carell's version of the comedy.

Reprising his role as David Brent on Thursday's episode, the British comedian, 49, bumps into Carell's Michael Scott outside an elevator (watch the clip above).

Though Carell starts by mocking Gervais' accent -- "You're picking on the wrong person," Gervais says -- the characters discover they have a similar sense of humor and eventually hug it out.

"What a nice guy," Carell says as he walks away.

The clip, which was filmed in September, marks Carell's final season of the NBC hit.

"I'm sure I'm going to be very nostalgic," the Golden Globe-winning actor, 48, told of leaving the show. "I mean, these are some of my best friends in the world! But it will be good -- it will be good for everybody."