I get this a lot, and it can really hurt! I noticed last night that the MacBook "Everything Mac" booklet has a diagram of how your hands should be positioned, at least from above.

For me, it's a combination of things: writing a lot, a certain pair of gloves with the padding just a little off of where it should be, and knitting. If you ride or write more than I do, that would take the place of the knitting fatigue

For home treatment, I try to do massage the thumb muscle during the day and I experimented with gloves and hand positions on the bike. I find that the hoods sometimes migrate inwards, and I have to move them back where they belong; that helped. And the glove padding--if it is too much in the wrong place, that seems to matter. (It got worse when I got new gloves)

Good luck!