Williams was thrilled to be retiring on a winning note after his 15-year professional career ended with a two-try haul which inspired the Ospreys to a record fourth league success.
"I enjoy success of course like anybody else. The one you remember is the latest one and this for me is a great way for me to finish," admitted the 35-year-old winger.
"I am very proud of the fact that I am associated with the Ospreys. We have worked very hard this season, we have had our ups and downs and there has been a lot of change in the ranks, with a lot of players leaving the region. For us to stick at it the way we have this season it's a compliment to the guys. I will never forget this day."
The victory seemed to be getting away from the Ospreys when Heineken Cup champions Leinster took a 17-9 half-time lead and Isa Nacewa's second try then pushed them 30-21 in front.
But the Welsh outfit, who finished second in the table, bounced back superbly to stun the RDS crowd with a 10-point spurt in the final 10 minutes. It was young out-half Dan Biggar who took on the mantle of match winner as having already kicked 14 points, he coolly converted Williams' 78th-minute try to edge the Ospreys home.
Their head coach Steve Tandy praised his players' character and fighting spirit to hold out until the final whistle despite Leinster threatening to hit back in injury-time.
Leinster head coach Joe Schmidt was understandably disappointed by the manner of the defeat which comes just eight days after they retained the Heineken Cup.
"I am pretty gutted obviously. We knew that it was going to be tough and we had to be in front in the back half of the game," said Schmidt.
"I thought it was a superb kick by Dan Biggar from the edge and it was pretty much the same thing he did to us last time to get a one-point win (here back in March)."