Bray, without a win in five, took a sixth-minute lead through Darragh Noone but Derry levelled on 22 minutes when Ronan Curtis went through to score.
Ryan Brennan headed Wanderers 2-1 up just before half-time.
Derry equalised again through Nathan Boyle early in the second half but Tom Clancy bundled in a late winner.
Clancy had scored the winner when Bray won away to Derry earlier in the season by the same 3-2 scoreline.
It was a huge disappointment for Derry as they had looked destined to get at least a point.
They recovered from that early Noone goal to level through Republic of Ireland Under-21 player Curtis who went on to beat home keeper Peter Cherrie after a superb pass by Nicky Low.
City will be disappointed with the marking which allowed Brennan the chance to head in Bray's second from Gary McCabe's free-kick delivery.
Derry levelled again when Aaron McEneff's pass found Boyle who turned to shoot low into the corner.
The visitors were undone by a set piece for a second time when substitute Clancy forced the ball in after a corner with nine minutes left.
The defeat sees Derry slip two places to fifth as Shamrock Rovers also moved above them by winning away to Finn Harps.
Derry City fell to their first defeat in 11 matches when they were beaten 3-2 away by Bray Wanderers who replace them in third place in the Premier Division.