Opting to bat first, Surrey declared their first innings at a massive 501 for seven and in reply, Worcestershire declared their first innings at 353 for nine, still 148 runs behind.
In their second essay, Surrey reached 136 for three in just 50 balls before setting their opponents a victory target of 285 from 62 overs.
Phil Jaques then came up with a 69-ball knock of 107 that included 14 boundaries and two sixes while Stephen Moore contributed 57 runs from 54 balls.
But Nayan Doshi, son of former Indian spinner Dilip, then ran through the Worcestershire middle order and the match was poised for a tense finish on a dark day.
Zaheer came out to bat at number 10 with four runs needed from the last two deliveries and he hoicked the first ball he faced from Nayan Doshi for a six and Worcestershire beat Surrey by two wickets with one ball to spare in the thriller.
Zaheer had failed with the ball in the match and his first innings figure read 27-7-110-1 and he claimed one wicket in the second innings, conceding eight runs in his only over.
Though he could not help his side win the tie, Nayan Doshi completed his 10-wicket haul in the match.