how many valves are you using, and how are they plumbed in,
if using multiple valves are you using a power beyond port to feed it or a return line, off of another valve?
i can not see the hose configuration clear enough to make out what you have,
I see no issuers with the mast,
how does the mast lift with out the cylinder? with a chain hoist or other? is it smooth and not binding in some way?
my guess is it is an open system on the hydraulics, are all valves for the same type of system?
I do not think air in the system would cause the problem stall problem, are all other functions working the way they should, (guessing hydraulic motor, and a cylinder to lift and lower the head)
my guess is it is either in the valve faulty or wrong type of internal construction, (and the valve should have a relief valve in it so the engine should not stall, and the valve should be able to throttle the flow of hydraulic fluid some, with locking up), or a plumbing problem of how some thing is routed or plumbed If other parts are working OK and the only circuit is the mast lift, I would think that is where the problem would be found, if the rod on the cylinder is not bent or have some kind of internal flow circuits, my guess is it is not the cylinder,
may be draw out the system on paper and show how it is plumbed, show all hoses and valves and there conections,
If your stalling the engine to a stop, then the fluid is not flowing (and it should be flowing via return or the over flow circuit)
all it takes is a small hunk of dirt and or some Teflon tape to mess up a hydraulic circuit, if Teflon tape was on some of the fittings (used fittings) that is some thing to consider, even if Teflon tape was used new on new stuff.
could put a pressure gaged in the line to see what is happening on the pressure from the pump, and one on the pressure to the cylinder a (5000 psi unit should surive a stall out)
also does the jerky ness come in both directions or just in raising of it?
http://northernhydraulics.net/hydraulics101.php