The former Bournemouth marksman, who scored 93 goals in 349 appearances for the Cherries, was twice on the mark in a nine-minute spell early in the game to sink the Blues.
Hayter, who holds the record for the fastest hat-trick in the Football League, was certainly in an opportunist mood for Yeovil, who went into the game as the joint lowest goalscorers in the division.
It was Birmingham's second straight defeat following an unbeaten run of 10 games, and their eighth consecutive winless game at St Andrew's without a victory, and kept them firmly in the bottom half of the table.
Yeovil remained in the relegation zone despite the win, but the 680 travelling fans will have headed away happy on their long journey back to the south-west.
The Glovers were in no small way assisted by some sloppy defensive play by Birmingham's makeshift rearguard, and were particularly helped by a calamitous mistake from stand-in central defender Hayden Mullins.
The veteran attempted - and completely missed - an intended headed back-pass to goalkeeper Darren Randolph, allowing Hayter to latch onto the ball and slide his shot past a helpless Randolph in the 12th minute for a gift of a goal.
The Republic of Ireland goalkeeper then distinguished himself with two saves in quick succession, parrying an effort from Joe Ralls and then smartly keeping out Kieffer Moore's close-range effort from the rebound.
But Randolph was beaten for a second time in the 19th minute by Hayter, who produced the perfect glancing header from Ralls' left-wing cross.
Hayter's two-goal blast was a wake-up call for Birmingham. Lee Novak hit the bar with a header and teenager Reece Brown hammered in a blistering shot which was well saved by Marek Stech.
Birmingham continued to muster the majority of the attacking play as the game wore on, but Yeovil were determined to hang onto their advantage and produced a dogged defensive performance.
New signing Brian Howard had a glorious opportunity to mark his Blues debut with as goal, but saw Stech pull off a point-blank save in the 69th minute - a miss which summed up Birmingham's frustrations.
Birmingham manager Lee Clark made three substitutions in the final half-hour in a bid to turn things around, but to no avail as Yeovil held on for a valuable three points.