Ulster let slip a five-point lead against 14-man Stormers to miss out on the United Rugby Championship final.
Robert Baloucoune and Stewart Moore cancelled out an early Stormers surge as Ulster led 15-10 at half-time.
It looked like Ulster would hold out when Adre Smith was sent off on 70 minutes, but Manie Libbok converted Warrick Gelant's try in the red to give the Stormers a last-gasp 17-15 win.
The Stormers will now the face Bulls in an all-South African final on Saturday.
The defeat means Ulster's trophy drought, which stretches back to 2006, will continue while the Stormers will have home advantage in Cape Town for the final against the Bulls, who defeated favourites Leinster on Friday.
The second half was scoreless until Gelant's try, which came against the odds after Smith was sent off for making contact with the eye area of Ulster captain Iain Henderson, and Libbok, who had yet to land any of this three previos attempts, split the posts with the final kick of the game to send the hosts to the decider.
Ulster hit back after slow start
Stormers took the lead through JJ Kotze in the fourth minute. Although referee Mike Adamson jogged under the posts to award a penalty try, his touch judge alerted him that the hooker had grounded the ball from the maul before it was brought down.
That spared Ulster a potential yellow card, and, in a further slice of luck, Libbok missed the conversion in what would be - until his decisive kick - an error-strewn display.
If the first was through brute force, Stormers' second was a flowing move which got the home crowd off their feet. From a line-out on the Ulster 22, Evan Roos broke away from the resulting maul and fed Herschel Jantjies out wide, who returned the favour for the number eight to touch down after skipping clear of diving and desperate tackles.
Libbok missed his second conversion, and Ulster hit back moments later when Baloucoune burst over in the corner following a penalty advantage.
A quick TMO check decided Moore's final pass was flat, much to the despair of the partisan home support, however the jeers turned to ironic cheers as John Cooney pushed the conversion wide.
That try settled Ulster, who were second best in the opening stages, and Billy Burns' sublime solo run, which consisted of two chip kicks, nearly resulted in a second try for the visitors but the home defence scrambled to clear.
However, it wasn't long before Dan McFarland's side got the try they deserved. Baloucoune turned from scorer to provider and his darting run created space for Moore, who gathered the winger's offload to score unchallenged and level the game on 28 minutes.
Cooney added the conversion to put Ulster into the lead for the first time before Libbok missed a drop-goal from inside the 22 after a sustained period of Stormers pressure - a mistake not repeated by Cooney as the Ulster scrum-half slotted a penalty with the final act of the half.
Late drama stuns Ulster
Action was limited in a scrappy opening 10 minutes after the restart, however Ulster were forced into a change early when Baloucoune pulled up when catching a ball and was forced off for Ben Moxham
Ulster, who had won 11 of their 13 URC games when leading at half-time, squandered a chance to extend their lead when hooker Rob Herring lost control of the ball when breaking away from a maul two metres out.
The hosts began to pile pressure on Ulster's defence with 20 minutes to play, but another mistake by Libbok - whose error-strewn afternoon continued as he kicked the ball dead when aiming for the corner - allowed the visitors to clear their lines.
With Ulster looking solid in defence, it looked like the visitors would secure their spot in the final when Smith was shown a straight red card with 10 minutes remaining for making contact with the face of Henderson, with referee Mike Adamson adjudging it was a serious act of foul play around the eyes of the Ulster captain.
Despite being a man down, Smith's dismissal boosted Stormers and they remained camped deep in the Ulster 22.
The clock was in the red when the ball was played wide to Gelant in the 84th minute and the winger took advantage of the time and space afforded to him to level the game.
There were visible nerves as Libbok stepped up for the final conversion, but he put his earlier mistakes behind him to land the kick and spark wild celebrations on the home bench and in the stands.
Stormers: W Gelant; S Senatla, R Nel, D Willemse, L Zas; M Libbok, H Jantjies; S Kitshoff, JJ Kotze, F Malherbe; S Moerat, M Orie; D Fourie, H Dayimani, E Roos.
Replacements: AH Venter, B Harris, N Fouche, A Smith, E van Rhyn, N Xaba, G Masimla, S Mngomezulu.
Ulster: S Moore; R Baloucoune, J Hume, S McCloskey, E McIlroy; B Burns, J Cooney; A Warwick, R Herring, T O'Toole; A O'Connor, I Henderson (capt); Marcus Rea, N Timoney, D Vermeulen.
Replacements: J Andrew, E O'Sullivan, G Milasinovich, K Treadwell, Matthew Rea, N Doak, I Madigan, B Moxham.