But Treviso hit back with two tries of their own in two minutes from Manoa Vosawai and Luke McLean with both converted by Kris Burton to leave the visitors 23-17 down.
But with Simone Favaro sin-binned in the 69th minute, the Ospreys pressed home their advantage with another try from Dirksen before a last-gasp score from Wales centre Ashley Beck earned his side a bonus point.
And though he was delighted with the result, Rees admitted it was a far more difficult test than the final score of 38-17 suggested.
"It wasn't as comfortable as the result looked on paper. Definitely not," said Rees.
"There were periods in that game when we weren't in control of what we were doing and we put ourselves under pressure.
"We are pleased we regrouped and it was an inner spirit that got us out of trouble and they had to fight for the cause to get the two tries in the final quarter.
"In the first 20-25 minutes we built a healthy lead and then (the players) took their eye off the ball.
"I think we were chasing something that wasn't there and that was disrespectful to Treviso."