Hi Michael
The metal tab which should hold the protruding part of the spring in place looks like it is flaring out too much which would cause the spring to jump out of place. It should have more of a hook shape to it. Compare it to Andy's bonnet catch image. You could try bending it inwards to create more of a hook to hold the spring in place. However, these springs do lose their tension and shape over time. If the spring still jumps out of place, you could drill a small hole in the bonnet catch plate near where it should hook, place the end of the spring where it should go and route a piece of metal wire through the hole and wrap it around the end of the spring and twist lock the wire to hold the end of the spring in place.
If all else fails, source a new bonnet catch.