Rain meant the match was reduced to 18 overs when play got under way at 18:30 BST, with the hosts asked to bat.
Another disruption saw Middlesex lose a further two overs and post 101-8 with fast bowler Tom Curran claiming 3-26.
Surrey slumped to 35-4, but wicketkeeper Ben Foakes (45) and Zafar Ansari (29 not out) helped them to 105-5 with four balls to spare.
The victory pushed Gareth Batty's men above Hampshire and Middlesex into fourth in the South Group to set up a trip to Northants in the last eight.
Middlesex's innings was played in near constant drizzle, but with both sides needing a win to be in with a chance of going through to the knockout stages, the players were reluctant to come off.
However, the hosts could not find any momentum on a slow pitch as John Simpson top scored with 29.
Surrey's chase got off to the worst possible start when Jason Roy nicked the first ball from Toby Roland-Jones behind and Steve Davies followed at the start of James Harris' next over.
Aaron Finch finally got the visitors going with three sixes before he played across the line to Ollie Rayner, but Foakes and Ansari played sensibly with a stand of 66.
Foakes chipped James Franklin to Neil Sowter with one run required, but the hard work had already been done.
Surrey squeezed through to the One-Day Cup quarter-finals with a five-wicket win at Lord's which put Middlesex out.