Ngidi took two wickets in that last over as England fell just short. Needing three runs off the last ball to win, and two to tie and force a Super Over, Adil Rashid got one and was run out coming back for the second.
England finished on 176-9 chasing South Africa's 177-8.
England went from long shots to odds-on favorites to win before the last-over drama at Buffalo Park in East London.
The tourists needed a testing 23 off the last two overs but captain Eoin Morgan hit three successive boundaries — four, four and six — to make it a much more manageable seven off seven balls.
But England lost some of that momentum when Morgan went for a fourth straight boundary down the ground off the last ball of the second-last over and was caught for 52 off 34 balls.
England was still expected to pull it off and get seven off the last over.
New batsman Tom Curran got two off the first ball but then went for a big hit out to midwicket and was caught on the boundary by David Miller.
Ngidi kept it tight and collected his second wicket of the over when he bowled Moeen Ali (5) on the second-last ball with England needing three off the last two deliveries. Then came the Rashid run out.
Ngidi finished with 3-30 off his four overs and also had the key wicket of Ben Stokes for 4 earlier. Stokes, Jos Buttler and fast bowler Mark Wood were all recalled to the England team having sat out the ODI series, which was shared 1-1.
South Africa started the first game of the three-match T20 series strongly with 43 from Temba Bavuma and 31 from captain Quinton de Kock at the top of the order.
England's bowlers pulled it back and Chris Jordan was — like Ngidi — brilliant at the end for his team with 2-28.
Opener Jason Roy blasted 70 off 38 balls to give England a flying start. His half-century came off just 22 balls, the second-fastest by an England player in T20s behind Morgan.
Roy was out caught by Ngidi to leave England 132-3 in the 15th over. Joe Denly (3) and Stokes couldn't make much of an impact.
Morgan appeared to have timed England's chase perfectly but his decision to go for that fourth successive boundary backfired when he hit a lofted drive straight to Bavuma at long-on.
There was more drama surrounding the dismissal when TV umpire Allahudien Paleker wanted to check replays to see if bowler Beuran Hendricks had overstepped for a no-ball.
Paleker, who is South African, eventually decided the delivery was fair and Hendricks had landed with a tiny part of the back of his boot behind the crease. But that decision was highly contentious and the England players in the dugout shook their heads to indicate their disagreement with the crucial call.