Three-time Heineken Cup winners Leinster took an hour to impose themselves before finally seeing off French champions Castres in Pool One.
Three Jimmy Gopperth penalties gave the hosts a 9-0 lead but the visitors hit back through Rory Kockott's converted try to only trail 9-7 at half-time.
Castres had two men sin-binned and Leinster scored via Jack McGrath's try and a Gopperth conversion and penalty.
Pedrie Wannenburg then came within inches of a late try for the visitors.
Castres have historically not been the best of travellers in Europe, but having won the French title last season they arrived in Dublin full of intent and were pushing Leinster right to the limit until the fateful decision to replace Kockott at scrum-half midway though the second half.
Julien Thomas was immediately penalised for feeding at three consecutive scrums, and that, combined with Remi Lamerat's earlier yellow card, was enough to tilt the balance decisively in Leinster's favour.
The hosts had started well, cruising into a 9-0 lead courtesy of Gopperth's boot, but as the half wore on Castres became more of a threat, especially at scrum time, and they scored the first try of the game.
Castres wheeled a scrum to open up the blind-side, Antonie Claassen picked up from the base, and the number eight fixed winger Fergus McFadden before giving Kockott the chance to scoot 30m down the line to score.
Kockott converted to make it a two-point game and it remained nip and tuck until midway through the second half.
Castres had twice threatened to score a try after kicks ahead and they also saw Kockott push a penalty wide, but any chance the visitors had of victory disappeared as a result of their own indiscipline.
Lamerat was the first to let his team down, smashing Dave Kearney into touch without using his arms and being sent to the sin-bin.
A couple of minutes later Kearney escaped down the right and although Castres managed to halt the initial attack, Leinster recycled and a series of drives by the forwards created the platform for prop McGrath to barrel over.
Gopperth converted before replacement Castres scrum-half Tomas repeatedly shot himself in the foot.
Three times he failed to put the ball in straight at the scrum, and three times the whistle duly blew.
Gopperth kicked a penalty as a result of the second infringement to give Leinster a decisive lead, and on the third occasion Tomas was sent to the sin-bin.
Down to 14 men once more the game was up for Castres, and although they nearly earned a bonus point - Wannenburg was ruled to have grounded the ball millimetres short of the line - the French champions headed home empty handed.
Leinster: R Kearney; McFadden, Macken, D'Arcy, D Kearney; Gopperth, Boss; Healy, S Cronin, Moore, Toner, McCarthy, K McLaughlin, O'Brien, J Heaslip.
Replacements: Fitzgerald for Macken (52), Madigan for D'Arcy (69), Reddan for Boss (47), J. McGrath for Healy (54), Dundon for S. Cronin (74), Bent for Moore (63), Roux for McCarthy (54), Ruddock for K McLaughlin (69).
Castres: Dulin; Martial, Cabannes, Lamerat, Evans; Tales, Kockott; Lazar, Mach, Peikrishvili, Gray, Capo Ortega, Bornman, Wannenburg, Classen.
Replacements: Palis for Evans (28), Tomas for Kockott (54), Taumoepeau for Lazar (28), Samson for Mach (47), Wihongi for Peikrishvili (45), Rallier for Capo Ortega (47).
Not Used: Diarra, Kirkpatrick.
Sin Bin: Lamerat (56), Tomas (70).
Ref: Greg Garner (RFU).