Thanks to Jacob The Badger for enlightening us with this tidbit:
"Mind your P' and Q's" comes from an old English pub phrase. When a barkeep was serving, he kept mindful watch on the drinks he gave to each patron in order to accurately asses the tab. In other words, to mind the pints and quarts of brew he was serving. Eventually this became shortened and put in a slang vernacular.