The painting was given to Wilde and his wife, Constance, as a wedding present, but he later sold it after becoming bankrupt.
The door is from Reading Gaol, where Wilde was incarcerated from 1895 to 1897.
Both items will be displayed at Tate Britain's Queer British Art show.
The exhibition will mark the 50th anniversary of the decriminalisation of male homosexuality in England and Wales.
Tate Britain director Alex Farquharson said the painting showed Wilde "on the verge of success".
"It's an extraordinary image of Wilde on the brink of fame, before imprisonment destroyed his health and reputation," he said.
"Viewing it next to the door of his jail cell will be a powerful experience that captures the triumph and tragedy of his career."
Curator Clare Barlow said: "The 6ft oil painting depicts him as a slender 27-year-old on the cusp of success.
"His stance is confident, holding a pair of gloves in one hand while the other clasps a silver-topped cane.
"It presents a different, more sombre image to the one we are more familiar with."
The 1884 portrait, by Robert Goodloe Harper Pennington, hung above the fireplace of Wilde's Chelsea home.
But Wilde later auctioned it, along with all his belongings, to pay his debts while awaiting trial.
He was sentenced on 25 May 1895 to two years imprisonment with hard labour in solitary confinement on the charge of gross indecency.
The exhibition will run from 5 April to 1 October, 2017 at Tate Britain.
A full-length portrait of Oscar Wilde once owned by the writer is going on display for the first time in the UK - alongside his prison cell door.