But they were made to work hard for a win that puts them clear to the top of the group regardless of the Ospreys' result at Northampton tomorrow as a Rory Kockott try kept Castres in the hunt throughout.
Prop forward Jack McGrath claimed the crucial score for Leinster just past the hour as they built on their 9-7 half-time lead after being forced to front up in defence for the initial stages of the second period.
And although Leinster never looked like losing from that point in, former No8 Pedrie Wannenburg came within a inch of pegging them back to within seven points when he was denied by the TMO in the dying stages.
"I certainly think we got out of jail with regard to them getting nothing. I don't think we got out of jail with regards to the result," said O'Connor, who was leading Leinster at home for the first time in the Heineken Cup.
"In the first half we were by far the better side. They got a lucky score and we didn't capitalise on our opportunities. They came back hard in the second half but we'll take the four points.
"Castres are a quality side. They are physically massive as a group. You don't fluke it and win the Top 14 unless you've got a really good squad. We put a lot of holes in them but didn't capitalise.
"That's one of those things. You take the four points and make sure we are better next time."
Next up for Leinster is a mouthwatering December double header with the Saints, the side they beat to win their most recent continental crown in Cardiff 17 months ago.