Gor Mahia had won their opening four matches and went into the encounter hoping to maintain their perfect start. However, KCB produced a disciplined performance to collect all three points against the defending champions.
The Bankers took the lead in the 20th minute through Batshi Assis Mambote, who controlled Paul Kinyanjui's effort before firing past Gor Mahia goalkeeper Kevin Omondi from close range.
KCB doubled their advantage in the 33rd minute when Richard Omondi capitalised on poor defending to score from inside the penalty area.
Gor Mahia responded four minutes later after Mambote fouled an opponent while attempting to clear the ball inside the box. Alpha Onyango stepped up and converted the resulting penalty to reduce the deficit to 2-1.
The visitors pushed for an equaliser, but KCB remained organised and defended their lead despite increasing pressure from the record champions.
Their task became more difficult in the 86th minute when Baron Ochieng was sent off after receiving his second yellow card. He had earlier been booked for a foul on Patrick Essombe before being cautioned again following an altercation involving Ebenezer Assifuah.
Despite playing the closing stages with ten men, KCB held on to secure their third victory of the campaign.
KCB coach Robert Matano praised his players for following instructions and showing character against a strong opponent. He also credited their improved finishing after the team had worked on converting chances in training.
Gor Mahia coach Charles Akonnor admitted that defensive mistakes had cost his side, while urging supporters to remain patient as the team looks to recover from the setback.
The result lifted KCB to 10 points, just two behind league leaders Gor Mahia, who will seek an immediate response when they face Nairobi United in their next fixture.