Tyrion is the son of Tywin Lannister, the legitimate Hand of the King (by proxy, anyway), and one of the queen regent’s two brothers.
Ned was an admitted traitor, and husband to an arguable traitor, and lord of a large but hardly respected parcel of land, who had lost his position as Hand when Robert died.
The situations aren’t nearly the same. Even Mr Tongueless McHeadchoppy would hesitate to kill Tyrion for no good reason, even at Joff’s say-so - a Lannister always pays his debts, so you don’t want to be owed a debt for ‘one head-chopping’.