I live very very near Hampton Court, could walk there in about 20 minutes. Hampton Court Station is practically adjacent to the Palace, come out of the station and you are practically on the bridge over the Thames and there it is Hampton Court the other side. 3 hours is not long if you want to take in the gardens as well which are lovely on a sunny day. The palace has more than one aspect to it, the obvious very Tudor part, which includes the kitchens which are worth a visit and set up as they would have operated mid 1500s. This area is obligatory it seems for school parties, I remember my children doing that outing in junior school and I often see school parties filing out when I dive past. The palace was also a residence for William of Orange (late Stuarts) who decamped there, I believe when Queen Mary II his wife died, because he found London dirty. You will see that part of the building was rebuilt during the William and Mary reign. If I remember rightly the Palace has some of his letters exhibited which I found interesting. Sometimes it can be a bit monotonous looking over the state apartment bit and I expect you will want to build in a break for tea and cake etc.
It is doable but expect to be tired and as you say, you will be heading back into London during the rush hour if you leave late afternoon, but against the tide until you reach Waterloo. I hope you enjoy it however long you decide to stay there and have a great day.