After years of HATING EACH OTHER'S GUTS -- Tom Arnold says he made a last minute appearance at Comedy Central's roast of Roseanne last weekend ... to bury the hatchet once and for all.
TMZ broke the story ... A few weeks ago Tom was adamant he wanted nothing to do with the CC bash ... not surprising since he and Rosey had a notoriously nasty split back in 1994.
But a producer for the show tells TMZ ... Tom initially turned down his invitation to participate in the "Roast" ... but had a change of heart at the very last second and contacted producers to let them know he changed his mind.
We're told producers were on board, but had to get the green light from Roseanne first ... and in another shocking turn of events, she said yes.
The best part ... we're told after Tom roasted her, the pair shared a private moment backstage for the FIRST TIME IN 17 YEARS.
In case you're curious, here's one of Tom's "jokes" that helped settle their long-time beef:
"She may not be the perfect wife, but she is literally the worst f-ing EX-WIFE on the planet ... trust me."