Boris Johnson mistakenly thanked Russia's Vladimir Putin for his "inspirational leadership" instead of Ukrainian President Volodymyr Zelenskyy.
The slip-up came during his first major contribution as a backbench MP since being ousted as prime minister.
In a general commons debate on the war in Ukraine, Mr Johnson said it is important to "double down in our defence of the Ukrainians" if Mr Putin doubles down on his "aggression".
As he listed the reasons why Ukraine's counter-offensive is proving to be successful, though, he inadvertently thanked Mr Putin, before quickly correcting himself and thanking Mr Zelenskyy.
He said: "Thanks to the heroism of the Ukrainian armed forces, thanks in part to the weapons that we are proud to be offering, I congratulate my right honourable friend (James Heappey) on his description of the work of the UK armed forces, the weapons that we're sending, the huge list...
"Thanks also, of course, to the inspirational leadership of Vladimir Putin."
Mr Johnson immediately realised his mistake and added: "The inspirational leadership of Volodymyr Zelenskyy, forgive me, the Russian forces have, in recent days been expelled from large parts of the north-east of the country around Kharkiv.
"And they are under increasing pressure in Kherson in the south, and I have no doubt whatever that the Ukrainians will win."
It was the second time the MP for Uxbridge and South Ruislip made a backbench contribution in the Commons.
In his first appearance since standing down as prime minister, Mr Johnson paid tribute to the late Queen Elizabeth in the special two-day event in Parliament.
During his speech on Ukraine, Mr Johnson also said the UK must be prepared to give "more military assistance" and "more economic support" to Kyiv.
He said: "If Putin is going to double down on his aggression, then we must double down in our defence of the Ukrainians, and we must be prepared to give more military assistance and more economic support, and I welcome warmly the announcements from this government this week."
Mr Johnson also warned against encouraging Ukrainians to do a deal to "trade land for peace" to allow Russian gas to flow to Europe.
Supporting Ukraine was a key policy during Mr Johnson's premiership.
He was a close ally of Mr Zelenskyy and visited the war-torn country three times in the seven months since it was invaded.
His final visit came at the end of August, when he said high energy bills are something UK households must endure as part of the effort to resist Putin.
Shortly before he left office, Mr Zelenskyy wrote a piece for the Mail on Sunday in which he heaped praise on the former PM, describing him as a "true friend" and "ally".