Leinster's Fergus McFadden also kicked two penalties in the first half and Luke McGrath grabbed the home side's first try before Taqele Naiyaravoro went over in reply for his first Warriors try.
The winger then went from hero to zero though as he was sin-binned and Leinster edged ahead with a penalty try before McFadden added a late penalty for a 23-18 win.
Glasgow also saw Pat MacArthur sin-binned in first-half injury-time for a forearm-led tackle that ended Aaron Dundon's involvement in the game, and head coach Townsend knows his troops must improve their discipline if they are to climb the GUINNESS PRO12 table.
"Before tonight I was really pleased how we had performed," said Townsend.
"Tonight we just missed those little bits of detail. I'll have to make sure we get those bits right and our discipline has to be much better.
"We had a slow start against Scarlets but showed great character to almost get a win and after that we have played pretty well.
"We almost won in Munster, got a good win against Connacht and got a bonus-point win against the Dragons.
"Against Leinster, in the second half we were down to 14 men for 20 minutes so that's probably why they had more possession and got the points on the board."
To buy tickets for the GUINNESS PRO12 Grand Final click here. Also follow us on Facebook, join the conversation on Twitter, sign up to our YouTube channel for extensive match highlights and sign up for our newsletter for regular updates on the GUINNESS PRO12.