I heard it long before Good Will Hunting. It was the sort of thing my grandparents would’ve said, and it was probably common around 50 years ago. Unfortunately, the origin of common phrases is a field rife with made-up origins. (I wouldn’t be surprised if there’s a claim that APPLES stands for something.) I wouldn’t trust an origin story unless there’s an attestation of the phrase somewhere reputable like the OED, or unless Shakespeare wrote:
‘So I ask you, good Sir, forsooth, tell me
If these apples are meet to thee, and sweet,’
Or something like that.
Another post I’d like to see show up later on in urban legend form… =)
Like Roches, I heard this phrase long before Good Will Hunting. I always thought of it as a kind of one-upmanship type of deal. “Yeah, you got me, but I got you back…how do you like that!”
Looking around on the web (waiting for samclem to get here with the definitive etymology) I found this website, http://www.wordwizard.com/clubhouse/founddiscuss.asp?Num=3348. The 2nd responder, Ken G., seems to have the best answer…the best researched by far.
Maybe it came from the grapes saying… which in turn might have come from the “Sour Grapes” saying. Might be a bit of a stretch, but I’ve heard stretchier histories proven true
Just wanted to add that my dad, who was born in 1941 and lived his entire life in Pittsburgh (with the exception of 2 years he spent in Germany in the early sixties in the Army) used that phrase a lot. I use it too, but only when using Homer Simpson’s “In your face Flanders!” would be inappropriate.