The match appeared to be heading for a goalless draw until a Wes Morgan error allowed McGoldrick to slam in the winner and lift Mick McCarthy's side up to 18th in the Championship table.
The first half was a fairly scrappy affair and it was no surprise that the two sides went into the break deadlocked.
The visitors were marginally the better side with on-loan Tottenham striker Harry Kane posing the biggest threat, drilling his first chance into the side netting after a surging run into the Ipswich box.
Kane was played in again by Richie De Laet shortly after but scuffed his shot wide and he had the ball in the net just before the interval only to be denied by a linesman's flag.
The best chance of the half fell to the hosts when McGoldrick's cross was steered goalwards by Michael Chopra to bring a smart save from Kasper Schmeichel.
Town emerged with more purpose in the second half and Carlos Edwards only just failed to get a toe to Lee Martin's driven centre before the Trinidad and Tobago man set up McGoldrick to call Schmeichel into action again.
Kane was then handed a gilt-edged chance to put the Foxes in front when he intercepted a loose backpass from Tommy Smith but he rolled his shot tamely wide with only Stephen Henderson to beat.
City threatened again as De Laet missed a volleyed chance from Paul Gallagher's free-kick while Morgan had to clear a dangerous Edwards cross from under his own crossbar.
And Morgan gifted the hosts the winner when he failed to deal with a high ball and Daryl Murphy pounced to feed McGoldrick, who slotted under Schmeichel from a tight angle.
The Foxes pressed forward in search of an equaliser but a stubborn rearguard action from Ipswich put another dent in Nigel Pearson's play-off ambitions.