David McGoldrick volleyed in his first goal since August to put Ipswich ahead.
Revell, who recently saved a penalty as an emergency goalkeeper against Preston, levelled from the spot.
Brett Pitman's glancing header restored Ipswich's lead, and Revell poked home Josh Murphy's free-kick to equalise before Varney's header sealed victory.
Ipswich manager Mick McCarthy: "It was exciting for both sets of fans but frustrating for me.
"We have already started thinking about next season - that is an ongoing process."
MK Dons manager Karl Robinson: "It was disappointing for us but it summed up our whole season. We were good but also poor in certain key areas.
"It has been a massive learning curve. Some of these players deserve to be in the Championship but some don't and that is why we are where we are."
Luke Varney's late winner secured Ipswich's first win in eight games, despite Alex Revell's brace for already-relegated MK Dons.