It kept Bath's hopes of a Heineken Cup berth alive - just - and left the Tigers still needing to secure a home semi-final in the Aviva Premiership play-offs.
The match-winner, with a 73rd-minute try, was captain Francois Louw, who appeared on the shoulder of replacement prop Anthony Perenise to sprint 30 metres to the corner. The hosts' tries came from Simon Taylor, Semesa Rokoduguni and Horacio Agulla, while Tom Croft and Ben Youngs crossed for Leicester and Toby Flood kicked 16 points.
The Tigers stretched the home defence more than once before a Flood penalty opened the scoring after five minutes. Stephen Donald missed at the other end but then barged through the first line of defence to create the momentum for Bath's first try. Rob Webber was stopped at the corner before Taylor crashed over and Ollie Devoto converted.
Bath were hitting hard on the gain-line but no-one got near Croft when Ben Youngs' pass sent the long-striding flanker clean away between Webber and Davey Wilson before rounding Devoto. Flood's conversion put the visitors 10-7 ahead after 15 minutes.
The lead was short-lived as Rokoduguni picked a Mathew Tait pass out of the air and travelled 40 metres for the try, only for Devoto to miss the conversion. Flood chipped over a penalty to make it 12-13 and Youngs then caught Bath completely cold, tapping a penalty inside his own 22 and racing 80 metres to the line after rounding Devoto.
Flood's conversion put Tigers two scores ahead for the first time and they must have thought they had the game won when Matt Smith touched down on 35 minutes. Unfortunately for them, it was ruled out by the TMO when referee Tim Wigglesworth queried a forward pass upfield.
Instead Bath finished the half on a high as they earned a penalty deep in the Tigers' 22. From the lineout, Donald sent an inch-perfect cross-kick over the left, where Agulla brushed past Tait to score. There was time only for Donald to kick the conversion and make it a one-point game at 19-20.
Flood kicked two penalties early in the second period but Tom Heathcote landed a simple effort on 54 minutes to make the score 22-26.
Then, seven minutes from time, Perenise came away from a maul - set up by Rokoduguni's catch - and the Samoan prop found Louw with a deft pass. The Springbok flanker raced 30 metres to the corner to score, edging Bath one point ahead. Heathcote's conversion was just wide, but the hosts had done enough.