Two goals from Shane Long and singles from Chris Brunt and Craig Dawson cancelled out two headers by ex-Baggie Reuben Reid to book the Premier League side’s place in the third round.
West Brom manager Steve Clarke made 10 changes from his side that clinched a last-gasp draw at Tottenham on Saturday, with Long the only starter in north London also fielded from the start at Huish Park.
The hosts started the brighter and came close to opening the scoring after five minutes. A dangerous free-kick by captain Jamie McAllister was met by the head of Byron Webster, with goalkeeper Boaz Myhill pushing the effort over the crossbar.
The threatening start by the Glovers, who sit top of League One following Saturday’s 4-0 victory at Scunthorpe, continued when James Hayter hit the post in the eighth minute after a goalmouth scramble.
The early pressure paid off on 15 minutes when a teasing free-kick by midfielder Ed Upson from the left was glanced past Myhill by striker Reid.
Reid, who was signed by Glovers boss Gary Johnson in the summer following his release from Oldham, featured just seven times during a frustrating spell at The Hawthorns.
The away side grew into the game as the first half developed, and drew level on 40 minutes after a sensational strike by Brunt.
Picking up the ball 35 yards out, the 27-year-old set himself before unleashing an unstoppable left-footed shot into the top right-hand corner of Marek Stech’s goal.
The visitors took the lead as the game entered added time in the first half. An inswinging corner by Brunt was fumbled by Stech and the ball fell to the feet of the prowling Long, who was on hand to find the net from close range.
Only three minutes after the break the League One side drew level. A raking ball from McAllister found Sam Foley down the left, who delivered an inch-perfect cross for Reid to head his second goal past his former employers.
Reid, who caused problems for Baggies’ centre-back pairing Craig Dawson and Gabriel Tamas all night, almost bagged his third on 59 minutes when his curling right-footed shot was smartly pushed around the post by Myhill.
The visitors nearly took the lead only seconds later when Yassine El Ghanassy saw his close-range shot saved by Stech, with Markus Rosenberg’s follow-up effort then hacked off the line by Richard Hinds.
However, the Premier League side took control as the second half developed, retaking the lead on 73 minutes when El Ghanassy’s strike hit team-mate Dawson and cruelly deflected past the helpless Stech.
Long then bagged his second and booked his side’s place in the next round after 82 minutes with a clinical left-footed strike past Stech from close range.