Electing to bat first, UP scored 245 runs for the loss of six wickets with skipper Mohammad Kaif (75, 7x4, 6x1) and Jyoti Yadav (83, 4x8) adding 148 runs for the fourth wicket.
Later, Parminder Singh (43) and Ali Hamid (21 no) added 58 runs for the sixth wicket.
In reply, Railways began on a confident note with openers G Shankar Rao (44) and Amit Pagnis (32) adding 81 runs for the first wicket.
Later, J P Yadav (57) and Sanjay Bangar (26) added 54 runs for the third wicket.
However, tight bowling and fielding by Uttar Pradesh players kept Railways under pressure.
Railways needed two runs off the last ball for victory.
But, UP wicket keeper M A Khan stumped Ankit Shrivastava of the last ball to decide the match in his team's favour.
UP bagged four points from the match.