Only four minutes remained when veteran striker John Barasa atoned for earlier misses by scoring the goal that delivered a 1-0 victory over Saint Eloi Lupopo from the Democratic Republic of Congo.
The result left the teams level on aggregate at 2-2 and Sofapaka qualified for the last-16 phase of the second-tier African club competition under the away-goal rule having lost 2-1 in Lubumbashi two weeks ago.
Patrick Kagogo found Thomas Wanyama with a deft pass and his cross was controlled by Barasa before slamming the ball past Lupopo goalkeeper and man-of-the-match Kikanda Kaniki.
The Congolese netminder made a series of superb saves before a large, animated Nyayo Stadium crowd as Sofapaka laid siege to the Lupopo goalmouth for much of a lively match.
Sofapaka will discover Sunday which one of eight African Champions League third round losers they face in a two-leg play-off during May and June with a place in the group phase at stake.
Promoted to top-flight Kenyan football only four years ago, Sofapaka pipped Aviacao of Angola on penalties and stunned former African champions Ismailia of Egypt in earlier rounds.
Success over Lupopo came at the end of a difficult week for the club as assistant coach Ezekiel Akwana and two other technical team members got one-month bans for not co-operating with coach Francis Kimanzi.
Daring Club Motema Pembe, the other DR Congo contenders for a 660,000-dollar winners cheque the vast central African country has never banked, squeezed through after another dramatic match.
They defeated Harras al-Hodoud of Egypt 2-1 in Kinshasa to leave the sides level on aggregate at 3-3 and Ilongo Ngasanya converted the tie-clinching kick in the penalty shootout.
AS Adema of Madagascar made the perfect start as they tried to overcome a three-goal deficit against Moroccans Difaa al-Jadida in Antananarivo with Jean-Christian Rakotonirina scoring just two minutes after the kick-off.
But it proved the only goal of the match and USFA of Burkina Faso were another club to win 1-0 at home -- against Sunshine Stars of Nigeria -- and be eliminated.