To answer your question: Is there any research: Not exactly. I am aware of research by NNGroup about the layout and presentation of search boxes with their labels and icons. Nothing about which way the icon is leaning.
But may I say I think it's very insightful of you to ask this question.
Images CAN have direction. That is, images can "point". This can be explicit, as with an arrow, or implicit, as with the direction in which eyes are looking or the direction in which a face is turned.
A picture of a magnifying glass definitely has direction, much like an arrow. The round glass is like an arrowhead, and the handle is like an arrow's tail. Together, they point left or right.
There's a nice little free e-book by Spencer Goldade (a former colleague, we have both since gone to work elsewhere). You can download the e-book here and then check out chapter 4. It's a light read, not an in-depth discussion.
Hope that helps, if only to confirm that your instinct is right: the direction of the magnifying glass does matter. Descending, now, purely into opinion: when the icon is outside the right side of the Search box I lean the icon in, toward the box, suggesting to use the box. When the icon is inside the box, I right-align it and lean it out, suggesting the action that is to come. Remember, this is just my opinion. That, plus $2, will buy you a cup of coffee.
More importantly is NN/g's advice to include the word "Search" along with the icon, because "icon-only search has some significant disadvantages" when the search box is in a non-standard location.
By the way, there are other factors at play, as well. In the examples you posted, none of the magnifying glasses are "upside down." They are all oriented as if ready for the user to reach out and grab the handle. Ask yourself: if direction didn't matter, then wouldn't at least SOME of these images be "upside down"?