Maxi Beier came off the bench and scored a late winner to give BVB the points against a stubborn Frankfurt side.