Hamlet and its sources are a variant on this. In the original Amleth, the main character feigns madness and an irrational obsession with sharpening sticks. Eventually, he uses these sharpened sticks to help pin down the woolen hangings in a dining hall, setting fire to them and letting his enemies roast alive.
Actually, it's never quite clear whether Hamlet is faking being insane, or if he really has gone whackadoodle.
On another Shakespeare note, Henry IV's Prince Hal, the future Henry V. He made himself out as a teen to be a drunkard completely unfit for the crown, so that when he finally ascended in all its glory, he made it appear as if God himself made him king. In this case it was more like obfuscating debauchery.
Shakespeare used this in spades. King Lear's Fool and "Poor Tom" (Edgar, disguising himself to avoid his pursuers), Feste in Twelfth Night, Touchstone in As You Like It, and many other jester-like characters. Casca in Julius Caesar, of "it was Greek to me" fame, acts like a moronic clod when around people with questionable motives - when around people who he knows are trustworthy, he becomes an intelligent, potent member of the conspiracy. Hamlet is probably the lord and master of this trope. He plays everyone but Horatio for saps. And depending on how far you're willing to interpret it, he basically orchestrates the entire play.
In Stephen Schwartz' musical Wicked, Galinda has got more smarts than she lets on (though she still doesn't nearly match Elphaba), and the villains of the piece (including the Wizard of Oz himself) keep up their doting, jovial personas to prevent anyone from antagonizing them.
Also, Fiyero. Even his Character Song, "Dancing Through Life", implies that he's just putting on an act. It's even more clear when he asks Elphaba if she really thinks he's stupid. (Until that point in time, she had.) She also points out that he's not really self-centered or shallow. After that scene, even Glinda begins to notice that he's not really stupid ("I'm so worried! It's Fiyero! He's been [gasp] thinking!"), self-centered ( he sacrifices himself to save Elphaba) or shallow, and that the whole things was just an act ([about them getting married] Galinda: "But it'll make you happy too, right?" Fiyero: "...I'm always happy" [runs offstage])
In Hairspray, Corny Collins doesn't act stupid, but rather resigned to the fact that his hands are tied, while secretly prepping events for Tracy and co to revolutionize everything for him.
In the stage production of Thoroughly Modern Millie, Mrs. Meers' two Chinese employees are a lot more aware of what's going on than she realizes. At the end, it's revealed that the one can understand English "better than [she] can speak Chinese" and thus knew all along that she had no intention of helping them import their mother to the US from Hong Kong. This, of course, leads them to quite willingly testify against her when she's arrested.
Sir Percy Blakeney in the musical The Scarlet Pimpernel (and every other version of the story as well) is a quick-witted young man who pretends to be a witless fop, the better to hide his war against the excesses of the French Revolution.
In Dorothy L. Sayers's The Emperor Constantine, Constantine and his father are about to quarrel. Helena comments about how Constantine looked just like he did when he was six. The directions note that this is maternal tactlessness — or guile, and it succeeds in derailing the quarrel.