Town left it late to beat Bolton at Portman Road thanks to Carlos Edwards’ first goal of the season.
The captain fired home with two minutes remaining to see Blues claim a massive three points and dent the Trotters’ promotion hopes.
Mick McCarthy made three changes to the side that drew with Peterborough, with Richard Stearman, Edwards and Daryl Murphy all staring in place of Elliott Hewitt, Guirane N’Daw and Frank Nouble.
Blues came closest to opening the scoring, with skipper Edwards nodding an Andy Drury cross just wide at the back-post after 13 minutes.
Two minutes later and David McGoldrick showed a neat turn to skip away from Marcos Alonso, before crossing for Drury but the midfielder headed straight at Lonergan from six yards out.
Chris Eagles, the man with the most assists in the division, tried his luck from range but fired over Stephen Henderson’s bar.
Town were looking the more threatening in front of goal and more impressive work on the right from McGoldrick saw him again beat his man before crossing into the area, although strike partner Murphy was unable to add a finishing touch at the back-post.
On the half hour mark, Jay Tabb crossed to the back-post and found Stearman, who headed across goal and almost found McGoldrick but Wanderers’ skipper Zat Knight managed to clear the danger.
Just before half-time, Murphy created a bit of space inside the box for himself but he was unable to get his shot away cleanly and Lonergan gathered the loose ball.
Blues started the second-half brightly though and McGoldrick found Murphy and the Celtic loanee sprinted past Craig Dawson and Knight but then fired his effort over the bar when through on goal after 50 minutes.
However the visitors were presented with a great chance to level the scores on the hour mark, as the ball fell to Eagles in the area but the winger sliced his effort wide of the target.
Six minutes later and Drury tried his luck for Town, but his half-volley flashed wide of the goal from 25 yards out.
Eagles was looking a danger for the hosts and he came close to breaking the deadlock with 20 minutes remaining but his hooked volley looped just over Henderson’s bar.
Soon after, David Ngog was found unmarked in the Town penalty area, but the French striker headed the ball into the ground and Henderson was able to watch the ball sail out for a goal-kick.
Blues fashioned an opening with seven minutes remaining, as Hyam cushioned the ball into the path of Edwards, but the skipper’s shot was easily kept out by Lonergan.
However Edwards wasn’t to be denied the next time, as the Town captain fired Blues in front with just two minutes remaining.
Great work by Jay Emmanue-Thomas on the left-hand side saw him dance his way past Sam Ricketts before picking out Edwards in the box and the Trinidad international fired low into the bottom corner at the second attempt.
Town had the chance to seal the win in injury time, as Murphy broke clear of the defence, but Lonergan stood firm to keep out his effort with a smart save.
But it wasn’t to matter as Mick McCarthy’s men held firm to claim a huge three points and send the Blue Army home happy.