Tom Shaw's superb late winner broke Bath hearts as Cambridge snatched a thrilling win at Twerton Park.
Charlie Clough pounced to give the home side the lead before Michael Gash levelled from 18 yards.
Marc Canham converted two penalties for Bath either side of goals from Ashley Carew and a Luke Berry header.
With the match tied at 3-3, and just six minutes left, Shaw's 25-yard lob proved decisive.
VIEWS FROM THE DRESSING ROOM
Bath City assistant manager Lee Howells told BBC Bristol:
"We're not happy, we're disappointed. I thought we put a massive effort in.
"If you had said to us two weeks ago we would score five goals in two games, we would have snapped your hand off.
"To keep a clean sheet Saturday and give four away tonight was disappointing, but there are still a lot of positives."
Cambridge United boss Jez George told BBC Radio Cambridgeshire:
"I think I preferred us when we were boring and liked to sneak 1-0 wins away from home.
"We did very well with the ball, but looked to be a bit of a soft touch without the ball.
"For my heart and my sanity we have to defend better than that."