Yes. When stubbing a toe I've historically employed two strategies for dealing with it. In my youth I would shout and hop around the room, i.e. distract myself. Nowadays I pay as much attention to the pain as is possible and practical. Remarkably this approach does seem to alleviate the pain.
So my guess is that the function of pain is to direct attention to injury. Not just for thinking about ways to avoid repeat injuries but purely and simply to promote the healing response. Which is not to say that I wouldn't welcome a painkiller if the pain was great enough. It's just that the suffering caused does seems to increase with the efforts one makes to distract oneself from it.