Southampton completed their pre-season campaign with a 4-3 victory over Real Sociedad in a thrilling clash at St Mary's Stadium.