You might like to refer to some of the ideas in the Plus issue 10 article, In space, do all roads lead to home?. It's all done with mirrors!
Jon Farradane supplied the following solution:
For an n-bounce route, find the nearest 'n-times reflected' image of one point as viewed from the other, using a mirror boundary. The ray path gives the solution. Jon says this works only for a boundary made of straight edges.
Jon also supplied a slightly more complex method which solves the 1-bounce problem and works better if you wish to take advantage of the curved areas of the table edge around the pockets. He suggests investigating the family of ellipses which have their foci at the two balls. The ellipse with the highest eccentricity that makes a tangent to the cushion will touch it at the bounce point for the shortest route.
Jon also raised the question of how to solve the problem for circular tables. The ellipse technique still works, but it's not an easy problem to solve analytically!