Pirates scratch out win over Appalachian State