The book of expressions “A Hog on Ice & Other Curious Expressions” by Charles Funk (available for a dollar at Abebooks.com) says the remark is used by another in a cutting manner when we deny that we ever wanted something that we find to be unattainable. Sour grapes are mentioned in the Bible in reference to the ancient proverb, “The fathers have eaten sour grapes and the children’s teeth are set on edge.” However the expression and the current meaning come from Aesop’s fable about the fox that tried in vain to reach some delicious looking grapes. He reasoned the grapes were probably sour and inedible, so it was just as well that he hadn’t been able to reach them.