Some good points have been raised about magma safety. We might have to go with iron or attempt to fill them with magma while shooting them at the goblins/elves/whatever.
I'd be inclined to try to shoot the carts through a recirculating magmafall located right before the ramp. With a 1 tile gap in the track, they'd clear it easy. The magmafall should minimize mess if designed right. The challenge is building a fall that reliably delivers 7/7 magma and whether the cart can pick up a full load of magma on the way out when at speed - I think it should. Is it reasonable to assume that the top speed of a cart is one tile per tick or does the derail functionality come as a result of the cart being accelerated beyond the time granularity of the game (I hereby define as the speed of sim)? So that it could get up to 2 tiles per tick, and so when the game calculates the cart's next position, it's then 2 tiles away, skipping over one which would be the curve in the track? If so, a railgun accelerated cart would suffer 2 additional problems:
1) By skipping tiles, it's also skipping rollers, so it gets increasingly expensive to accelerate your cart past that 1/1 threshold.
2) By skipping tiles, it'd possibly also skip things like the magma load, or the collision event at the end. We'd have constructed a Dwarven Tunneling Railgun.
I'm also thinking that in the interests of maintaining the utility of the entrance for wagons, that 3 parallel guns that release carts simultaneously would work best.
And I think the idea of using non-magma safe carts in this arrangement and having them melt on impact is highly desirable. You'd need to work out the rough timing of how long the cart can function as a cart while it melts, and load the magma shot at just the right time.