United 8 +4GD
Peterhead 8 +3GD
Saints 7 +8GD
So
if Peterhead win - they win group, United are second.
if St Johnstone win - they win group, United are second
if it's a draw, and Peterhead win penalties, they win group, Saints are second
if it's a draw and Saints win penalties, they win group on goal difference, Peterhead are second
?