Voglsammer came off the bench to hit the winner in the last-eight tie and send Union into the last four of the cup for the first time since 2000/01.
Second-division St Pauli took a first-half lead in Berlin when a free-kick by Ghana midfielder Daniel-Kofi Kyereh found the back of the net.
Union drew level thanks to Sheraldo Becker's chip just before the half-time whistle.
Voglsammer capitalised on a long pass and a slip by St Pauli defender Jakov Medic to bang in the winner 15 minutes from time. The 30-year-old Voglsammer then hit the post in stoppage time.
This is only the second time in the cup's 72-year history that four second-division teams made the quarter-finals, as most of the big clubs fell by the wayside.