Town were two up at half-time, with goals via a Lloyd Kelly own goal and Allan Campbell’s first for the club.
The Cherries found a way back into the game through Emiliano Marcondes and Morgan Rogers.
But with seconds left, the ball fell to Naismith, who sold the defender with a brilliant dummy, before finding the bottom corner for Town’s winner.
Nathan Jones made two changes to the side that were 4-0 winners against Harrogate Town in the Emirates FA Cup last weekend. Pelly-Ruddock Mpanzu and Allan Campbell return in midfield, with Henri Lansbury and Carlos Mendes Gomes on the bench.
The game’s opening minutes were a cagey affair, with Town registering the first opportunity. Elijah Adebayo broke into the area after being found by Amari’i Bell, but the attacker couldn’t get a shot away.
That effort sparked the visitors into life, with Ryan Christie finding space and forcing James Shea into a smart stop.
Town continued to threaten the Bournemouth goal, with Naismith at the heart of two chances. The defender flicked a header on from a Bell throw-in, with the ball eventually punched clear by Mark Travers.
The second chance saw Naismith’s first-time volley saved by the Travers’ legs, being put out for a Luton corner, which was eventually cleared by the Cherries.
Emiliano Marcondes was next to have an effort on goal in a lively first-half of football at the Kenny, with his free-kick being saved by Shea.
And just before the half hour mark, Town would be in front. Pelly-Ruddock Mpanzu’s cross was flicked into Adebayo’s path. His effort was saved by Travers, before being turned into his own net by Kelly.
Adebayo continued to be a constant threat for Town in the opening 45. After a charging run, his effort was deflected wide for a corner.
From the resulting corner, the Hatters thought they had added a second. Bournemouth failed to clear their lines, and Cameron Jerome reacted quickest to finish beyond Travers. However, after a lengthy discussion with the referee and linesman, the goal was ruled out for offside.
Town would have their deserved second goal before half-time. Campbell had acres of space on the edge of the Bournemouth area, and found the bottom corner with a brilliant effort.
Bournemouth would pull a goal back six minutes into the second half. Jack Stacey beat a number of Town players on a surging run, before finding Marcondes with a brilliant cross, who headed in.
Jones was forced into his first change of the afternoon, with Campbell unable to continue. Fred Oyedinma came on in his place.
Town were forced into another change minutes later. Reece Burke’s afternoon came to an end just after the hour mark, with Gabe Osho replacing him.
A tame half of football in comparison to the first, Mpanzu had an effort for the Hatters, but it was straight at Travers.
The away side would find an equaliser through Rogers. Jamal Lowe’s ball into the box found Rogers, who fired beyond Shea.
Henri Lansbury was introduced as Town’s third and final substitution late on, with Jerome making way.
Jordan Clark almost put the Hatters back in the lead five minutes from time. He latched onto a long ball forward from Shea, with his venomous effort tipped over the crossbar by Travers.
With the game seemingly destined for a draw, Town would find a winner in fantastic fashion. A free-kick fell to Naismith on the edge of the area, the defender brilliantly sold his marker with a dummy, and found the bottom corner with a curling effort.
In front of a sold attendance of 9,649, the roof came off at the Kenny with a brilliant and dramatic ending.
Goals:
Town: Kelly OG (29’), Campbell (42’), Naismith (90’)
Bournemouth: Marcondes (51’), Rogers (78’)
Att: 9,649 (1,032 away)