Prior to the 2022 FIFA World Cup, in Qatar, Wales had qualified for the finals tournament just once, in Sweden in 1958; provided the other three Home Nations – England, Northern Ireland and Scotland – also qualified that year (which, of course, they did), 1958 must be the answer.
None of the Home Nations participated in the World Cup in 1930, 1934 or 1938, having withdrawn from FIFA in 1928 and not rejoined until after World War II. In 1958, British Home Championship ceased to be a qualifying tournament for the World Cup so, for the first time ever, all four had an opportunity to reach the finals.
Wales originally finished second to Czechoslovakia in their UEFA qualifying group, but qualified via a two-legged playoff with Israel, who won their group by default after Indonesia, Sudan and Turkey refused to play because of international tensions. Im Sweden, they drew with Hungary, Mexico and the hosts before beating Hungary 2-1 in a playoff to advance to the quarter-finals, where they lost 1-0 to eventual winners Brazil, with the winnimg goal scored by a 17-year-old Pele.
Northern Ireland, too, fared above expectations on their finals debut. They beat Czechoslovakia 1-0 and recovered from a 3-1 defeat by Argentina to draw 2-2 with West Germany, which was enough to earn a playoff against Czechoslovakia, which they won 2-1 after extra time. Northern Ireland were subsequently trounced 4-0 by France in the quarter-finals, but still progressed further than England or Scotland, who were early casualties.
Scotalnd managed a 1-1 draw with Yugoslavia in their opening group game, but lost to Paraguay and France, 3-2 and 2-1, respectively to exit the tournament with just a single point. England drew all three group games, against USSR, Brazil and Austria, but lost 1-0 in a playoff with USSR, who would, themselves, be knocked out by Sweden in the quarter-finals.