The Aston Villa defender's 35th-minute strike and the Norwich midfielder's effort 14 minutes from time were enough to end a run of two successive defeats at the Aviva Stadium.
Ireland had to defend tenaciously, particularly during the first half, and keeper David Forde made a series of important saves to deny dangerous striker Robert Lewandowski.
Trapattoni handed Derby midfielder Jeff Hendrick a debut when he and Jon Walters replaced McCarthy and Brady with 19 minutes remaining.
Lewandowski in particular was refusing to throw in the towel and Ireland were forced to defend deep and in numbers as the game entered the closing stages.
But they gave themselves breathing space with 14 minutes remaining when Hendrick picked out fellow substitute Wes Hoolahan and he controlled with his chest before firing left-footed past Szczesny for his first international goal.
Defender Richard Keogh became the third Derby player to win a first cap when he replaced Clark with five minutes remaining.