Tashreeq Morris opened the scoring in the 25th minute before Paulus Masehe bagged an equaliser ten minutes before the break.
But a 40th minute strike from Thabiso Nkoana saw the Urban Warriors claim another valuable three points.
Both sides started the match at a low tempo with Ajax edging the possession stakes, although without creating any real goal scoring chances, as they came up against a determined Stars defence.
Nkoana enjoyed the first clear-cut opportunity of the tie as he smashed the ball goal wards on 11 minutes but Stars stopper Ayanda Mtshali was well placed to make a comfortable stop.
Moffat Mdluli tried his luck with a long-range strike with 24 minutes played but Anssi Jaakkola was happy to let the tame effort fly well wide of the target.
But Morris needed just the one touch to slot home from just outside the six-yard area when presented with a delightful Nkoana ball to score on 25 minutes.
Buoyed by the goal, the home side upped the tempo with Cecil Lolo coming close to an Ajax second with a rasping drive that hit the woodwork.
The missed looked to prove costly as Masehe volleyed home from a 35th minute corner but Nkoana restored his side's lead with a neat finish as he slid in a Lolo cross from close range.
Morris should have added a third just minutes into the second stanza having latched on to a Nkoana pass, but he sent his shot inches wide.
Stars introduced Rudolph Bester in to the action moments later and he so nearly made an immediate impact with a 68th minute free kick but Jaakkola was equal to the effort as he threw himself low to his left to make the save.
It was the visitors who looked the most likely to grab a late goal in the closing stages, with the injury to captain Travis Graham not helping matters, although Ajax had an able replacement in Lance Davids.
And despite Mosa Lebusa seeing his 87th minute shot well saved by Mtshali, Roger De Sa's charges held on as Stars peppered the home defence in the dying minutes of a thoroughly entertaining Premiership clash.