Noah Weißhaupt's second-half strike was decisive as St. Pauli ended their winless run and boosted their survival hopes with a hard-fought victory over Hoffenheim.