Chances were few and far between in the first period with Rovers' strike duo Thomas-Moore and Marvin Sordell both flashing half chances wide. But the Gills should have been ahead after 23 minutes when Luke Rooney got on the end of Chris Palmer's cross but he headed wastefully over.
Gillingham's leading scorer Simeon Jackson forced Luke Daniels into a smart save on the half-hour mark and Rooney went even closer immediately after the restart when the youngster fired Andy Barcham's cross against the crossbar.
Thomas-Moore then broke the deadlock when he slid the ball in at the back post after Gareth Edds' cross had caused disarray in the Gills box.
Gillingham piled forward with Palmer rolling a shot wide six minutes from time and Danny Jackman blazing a shot over but Tranmere held on for a priceless win.