The move that led to Gillingham's match winner involved all three substitutes. Mamady Sidibe crossed from the right, Mark Saunders seemed to get a touch, leaving Perpetuini to compose himself before sending a low shot wide of Thomas Myhre.
Myhre was making his debut for the Eagles but it was Gillingham's Jason Brown who again caught the eye, with several important stops, and a penalty save to deny Dougie Freedman early in the second half.
Gillingham got caught short on numbers at the back and as Freedman went through, home centre half Chris Hope brought him down.
Referee Howard Webb adjudged him to have been the last man, and dismissed him, with the player confirming afterwards that it was the first dismissal of his career.
However, despite their numerical disadvantage Gillingham gritted their teeth and kept working hard, knowing that they had had enough chances in the first half to have been in front of themselves.
They had several shots off target in the first 45 minutes compared with Palace's two, the best of them falling to Nicky Southall, who got behind the Palace defence and was left one-on-one Myhre but wanted too much time and the chance went begging.
Then both sides could have snatched the lead. Gills skipper Paul Smith had a shot blocked, before Palace raced to the other end, for Freedman to dance into the six-yard box, only to see his effort kept out by a fine one-handed save from Brown.
Brown also tipped over a goalbound Kit Symons effort past the midway mark of the second half before Gillingham player-manager Andy Hessenthaler rang the changes, as Sidibe replaced Rod Wallace, Perpetuini got his chance to replace the boss and Saunders came on for the last eight minutes.
The goal stemmed for almost Perpetuini's first touch but Gillingham were grateful for the victory after four successive defeats had seen them drop into the bottom four of the first division table.
Gillingham: Brown, Nosworthy, Ashby, Hope, Cox, Hessenthaler, Smith, Southall, Hills, Shaw, Wallace. Subs: Saunders, James, Spiller, Perpetuini, Sidibe.
Crystal Palace: Myhre, Fleming, Symons, Popovic, Smith, Derry, Riihilahti, Black, Johnson, Freedman, Shipperley. Subs: Berthelin, Hughes, Routledge, Watson, Borrowdale.
Referee: H Webb (S Yorkshire).