I think the small multi-tool idea is an excellent one. I think the Leatherman Squirt P4 is a nicer tool than the Leatherman Micra, personally. Also, a SAK, especially one with silver Alox handles rather than plastic ones, are very useful while also being classy. And whatever you get, engraving their initials or last name will help make them special.
A personal favorite of mine, even though it is not very costly, would be the Victorinox Classic SD in Alox. It is nothing to pocket, very useful and would appeal to someone whether or not they are a knife person. Probably within your $40 budget even with engraving and shipping costs.
There are no perfect groomsman's gifts. At best, they will love it and use it every day. At worst, they will have no use for it whatsoever and it will disappear in the back of a drawer to be forgotten and lost. The vast majority of groomsman gifts fall into the second category. At least with a multi tool or SAK, the worst case would be that it is only used occasionally and would still therefore be a lasting symbol of your friendship.