Oldham Athletic 0 Huddersfield Town 1
Manager Ritchie oversaw a narrow 1-0 victory for his Terriers and the goal was scored early by Beckett, who had a productive spell at Boundary Park two seasons ago.
Both teams beat Premier League opposition in the previous round, with Oldham shocking Everton away from home and Huddersfield knocking out Birmingham.
Ritchie and Oldham manager John Sheridan wanted to avoid each other in the fourth round as they have been close friends for many years, but it was the Huddersfield chief celebrating at the final whistle.
He said: "That was a really good battling performance and I'm delighted with the players. I hope the draw, on Monday, gives us a cup final at somewhere like Old Trafford.''
Sheridan admitted: "I cannot fault our effort but we lacked a bit of quality and I know I need to bring in two or three new players.''
Huddersfield almost took the lead when midfielder Andy Holdsworth found a great position six yards out only to see his flick cleared off the line by Mark Allott.
But the visitors did not have to wait much longer for their breakthrough as captain Jon Worthington took a long throw-in towards the near post and Beckett headed home from eight yards.
Oldham took control after the blow to their confidence and Jean-Paul Kalala was denied by keeper Matt Glennon, who then made a stunning save high to his right from Deane Smalley's bullet header.
The Latics dominated until half-time but defender Neal Trotman headed off target and their chances dried up after the break.
Craig Davies sent two shots well wide and Huddersfield saw out their victory with few real problems.