While this design does try to use Gremlins' own penchant for pulling levers against them, I doubt a falling minecart would fall quick enough to hit it.
If you wish to kill a gremlin, I would put a lever in the middle of a long tunnel leading into your fort and have it activate a minecart grinder. Gremlin goes down the tunnel, pulls the lever, and continues on into the fort. A minecart is released to propel forward either via powered roller or impulse ramps. The tunnel the gremlin went down is engraved (or built) with tracks, and a side passage returns the minecart to a stop where it may be reset. Gremlins are small enough I doubt more than one impact would be needed, though the real question is if the minecart would hit it when stealthed (most likely yes)
If you wish to capture it, to either train or kill at a later time, a simple cage trap with emitted webbing on it will work. Naturally occurring webbing, should it 'spawn' on a cage trap, will not cause the trap to trigger in my experience.
While you have the caverns open, your working dwarves and any guard animals you place should spot any incoming gremlin, who will turn tail and run as soon as they are seen. Should you with to leave the Cavern open yet keep up a guard against gremlins, I would place a guardhouse right at the entrance to the caverns; 1x1 rooms above the tunnel, floor channeled out and replaced by grates, sealed by doors, with your animal of choice locked within. I have had great success with this design to spot were creatures on the surface before they enter the fort.