A few more thoughts on the part that "might" be from a P-38. Normally hydraulic actuators are attached only at each end in such a way that as the piston moves the whole unit (body and piston) can rotate. This is what is seen in the actuators that move the landing gear and in those that open and close doors and flaps.
This small part appears to have been attached in such a way that the body would not move as the piston expands. (See the broken flange that was apparently used to attach this part. The two holes on each end are broken out). In looking around on a P-38 for a part that might have been used in that way I found the acutator that locks the front wheel well hatch closed. It is very hard to find a photo of this acuator, as it is located on the very front left side of the front wheel well. When the front wheel is down the wheel struts (which have swung forward) block the view. Also the acuator is up inside the wheel well, attached to the left sidewall.
There are some drawings in an "Erection and Maintainence Manual for Army Model P-38L" that show the part but things such as the hydrauiic lines to and from the actuator are omited. Some of the drawings do not show exactly how the unit is attached to the sidewall.
The manual (with some pages missing) can be found on this link:
http://www.xtrmntr.com/lightning/repo.html
The "S" , "G" , "M" and "D" at the end of the lines are actually the links to the files on Scribd (click the "S"), Google (click the "G"), Microsoft (click the "M") and Dropbox (click the "D"). It appears the Dropbox links no-longer work but the others seem active.
The first item on the link above is Part 1 of the Erection Manual. The "G" link gets to a pdf file on Google docs. On pdf page 49 (which is manual page 93) and pdf page 52 (manual page 96) you can see some drawings of the latch acuator. The drawing on page 52 is a little more detailed and it does show an attachment method to the sidewall. Perhaps the attachment method in various P-38 models was different. At any rate it appears that the acuator is fairly small and the piston does not need to move very far to lock the hatch door via the "jaws" mechanism.
I could not find a photo of the actual locking actuator part on line. You can find photos that show the "loop" on the hatch that the locking jaws grab. Maybe someone has access to a P-38 (maybe in a museum somewhere) and could get permission to take a photo up inside the wheel well which would show the actuator.