Portrayed/appeared in same film

In the movie Dave, lots of politicians - including Arnie before he became one - had cameos as themselves.

Kevin Costner plays Jim Garrison in JFK. Jim Garrison has a part as Earl Warren in the same movie.

Should have gone the other way with your guess: Devito is not portrayed as a character, but the character played by Devito- George Shapiro- appears (the real life guy) in the film playing the role of Mr. Besserman.

Saint Cad already pointed out that Zmuda, played by Paul Giamatti, appears (the real life guy) in the film playing Jack Burns during the Fridays! staged fight.

I’m actually surprised this movie doesn’t have more examples (it does, but only if you count actors playing themselves).
I thought Confessions of a Dangerous Mind would have a few, but other than a few people playing themselves- and Barris appearing at the end (but, as himself)- no examples to be found, except one point of confusion maybe another Doper can clear up:

Actor Joe Cobden is credited as playing The Unknown Comic. In real life The Unknown Comic was the stage persona of Murray Langston. Langston, himself, does appear in the film- however, imdb lists his character as being “Actual Unknown Comic”. So, I’m confused on that one.

In Beyond the Law, Charlie Sheen plays Dan Saxon, a cop who went undercover in a motorcycle gang. The real Dan Saxon appears in a mob of bikers at one point in the movie.