In the 13 years since becoming affiliated to Fifa, American Samoa have been cast as the ultimate whipping boys of international football. Each one of the Polynesian United States protectorate's first 30 matches ended in defeat and their goal difference of minus 217 emphasised a deficit in class rarely seen since Bon Accord earned their notoriety 126 years ago.

In 2001 they were beaten 31-0 by Australia, an international record defeat that has become a clip-show staple, complete with patronising and snide mockery of the team's shortcomings. Regardless of what happens in Sunday's final and decisive preliminary Oceania World Cup tournament match against the hosts, Samoa, American Samoa's achievement 125km away from home this week in Apia, where they registered their first official victory, against Tonga, and draw, against the Cook Islands, are part vindication, part miracle.

The scale of the defeat by Australia at Coffs Harbour a decade ago inspired the producer Kristian Brodie and directors Mike Brett and Steve Jamison to make a documentary about the team and the crew began shooting for Next Goal Wins during the Pacific Games tournament in August. "The thing that impressed me was that they were 16–0 down at half-time and yet the players who, because of passport issues and high-school exams at home, were not the first-choice squad, still came out and really exerted themselves," says Brodie. "We wanted to know where that spirit came from."

The one established international in the 2001 team, the goalkeeper, Nicky Salapu, is the only survivor among the players making history. Understandably, the mauling traumatised him and the praise he received for pulling off a dozen excellent saves to spare further humiliation was little consolation. He admits he found it difficult to cope with the shame and turned to drink for a while, but a friend's gift of a PlayStation allowed him to undergo a unique form of self-diagnosed therapy. Sadly, American Samoa, the bottom-ranked team since 1998, are not one of the teams available on the Fifa series of games. He loaded a match between Samoa and Australia instead, left one controller idle and guided Samoa to a 50-0 victory which, he says, helped him get the real defeat out of his system.

The Pacific Games implied that business as usual would be the main theme of Brodie's film. Losing all five games and conceding 26 goals in the process, American Samoa's chances in the preliminary World Cup tournament were more non-existent than negligible. But a month ago their luck changed. American football dominates the island's sporting scene: natives and the American Samoan diaspora have produced notable NFL stars such as Junior Seau and Troy Polamalu whose replica shirts provide a kind of uniform on the streets of the capital, Pago Pago. Tavita Taumua, the football federation's general secretary, had found it difficult to build the same prominence for football that gridiron enjoys and for five years had been trying to get financial support from US Soccer; in particular, their help in the recruitment of an off-island coach.

In October they agreed to loan Thomas Rongen, an Ajax-trained disciple of Total Football who had managed four Major League Soccer teams as well as the US Under-20 side for almost 10 years, for the duration of the tournament. The transformation after Rongen's arrival was, says Brodie, profound. Within a week of the arrival of the "Palagi" – the Samoan word for white off-islanders which translates literally as "cloud-burster" – the improvements in organisation and discipline were extraordinary. Most significantly, though, was the change in mentality his coaching had brought, so much so that when they defeated Tonga 2-1 on Tuesday and drew 1-1 with Cook Islands on Friday there was no complacency – the players were frustrated at not keeping clean sheets.

Rongen has been with the team for less than a month and found the tactical reorganisation easier than the psychological one. "I am steeped in the Dutch football tradition," he says. "The teachings of Rinus Michels and Johan Cruyff and a technical brand of football is my motivation but what I encountered here was the exact opposite. So I had to adapt. I went from an old-style 4-4-2 to a more modern 4-2-3-1 because since it's obvious that they give away too many goals, I thought four defenders and two holders would help. It's easier to teach inexperienced players how to defend than to attack but we've made great strides in organisation and communication.

"But the main thing has been mental. Even in training games they lacked confidence. They had gone into games thinking that if they could conceded only 10 they would have done a good job. We've had meditation, yoga sessions, trying to instil in them that they have to live in the now not the past, a process of continuous positive reinforcement. There's a traditional hierarchy, too, which is a delicate matter. In the tribal structure the youngest ones are pretty much told what to do and what not to do. We've had to get them to be more proactive, take risks. I have tried to break through a cultural barrier so they can solve problems without looking to me, their elder on the sidelines and asking: "Coach, what do we have to do?"

The other breaker of barriers in the squad is Johnny "Jayiah" Saelua, a fa'afafine, biologically male but identified as a third sex widely accepted in Polynesian culture. She – and she prefers she – is the first transgender player to compete in a World Cup match and has formed a centre-half partnership with the Arizona-based Rawlston Masaniai, who along with other team-mates, calls her "sister". "There is no discrimination," she says. "I put aside whether I'm a girl or a boy and just concentrate on playing. I think I add a third dimension to the team, collect my energies and keep the team together, that's my responsibility as the fa'afafine, the feminine."

Rongen, whose daughter was killed in a traffic accident in 2004 and set up a charity in her memory, is keen to emphasise that he has been as much a beneficiary from the experience as the team. "There's a 20mph speed limit in Pago Pago," he says. Back home in DC I'd blast to work past the Pentagon, thinking I'd got to lead my team into battle because if I didn't I would lose my job," he says. "Here there is a methodical, pure, slow way and I have slowed down and thought about my daughter a lot more than I have recently. It's put me back to my roots with my passion for the game and reconnected me with the things that are important in life such as hugging my wife. This isn't about money for the players. I am a non-believer, an atheist but the religion and culture here are so strong it's like a spiritual experience. I don't believe in God. But there is a connection I feel, something special." He may not believe but his four-week sabbatical has been a triumphant leap of faith.

Next Goal Wins, a feature documentary about American Samoa, will be released in the spring. Coproduced by Agile Films and Archer's Mark.