English referee Howard Webb ruled that Mariusz Lewandowski hauled down Sebastian Proedl and substitute Vastic slammed the penalty past Artur Boruc.
Boruc had earlier made a string of stunning saves to deny Poland, with Martin Harnik wasting two fine chances.
Poland's goal came when Roger Guerreiro converted a first-half cross from an offside position three yards out.
It was a dramatic end in Vienna and both sides' chances of qualifying for the quarter-finals remain slim, though Vastic's goal does send Croatia through to the last eight.
Austria coach Josef Hickersberger believes justice was done: "They had their backs to the wall, we should have been 2-0 up but we didn't score.
"My team reacted well after falling 1-0 behind to a goal that was offside.
"The sport of football is not always about justice: when the referee decides something, it is like he is God."