The show opens with Future Ted telling his kids that Marshall and Lily are back together.
Ted and Marshall's Apartment
Lily is tasting pancakes that Marshall made, which are delicious, when she says "At least I'm marrying a guy who knows how to make pancakes." Which stops Marshall cold, as they haven't discussed about their future yet. She says that she'd still like to get married if he wants to. Marshall can't believe that that is how she's proposing to him, and compares it to how he proposed. She then attempts to propose, which he criticizes and tells her how to do it. After a frustrating few tries, she just flat out tells him to marry her.
Ted and Marshall's Kitchen Floor
We see Marshall and Lily sit up from on the floor, hair messed up and flour all over them. They are estatic about getting married, then are instantly filled with doom when they realize whats ahead.
7 months earlier at the apartment
We see Lily leaving with her bags, then we see Marshall on the couch with mounds of crumpled tissues telling his family members that the wedding was off.
Back to present day
Lily freaks out about standing in front of his family who probably hates her, and says she'd rather go to Atlantic City and elope that day. They decide thats what they'll do.
At Robin's Newstation
Marshall and Lily go to Robin's work to tell her the good news and ask her to come with them, which she does.
At Ted's Office
They ask Ted to go, at first he is unsure about leaving his project, but after some coaxing from Lily, decides to go.
At a nail salon
The gang runs in and Barney is currently getting a pedicure. They get Barney to go, but he wants to go after his pedicure. Lily decides she'd like one on her wedding day as well. Next scene, the entire gang is seated and each is getting a pedicure.
Casino at Atlantic City
Barney hints to the group that he's been to Atlantic City a few times, espcially when a random Chinese man comes up to him, and starts a conversation with him in Chinese, which he replies back in Chinese. Lily realizes she can't get married without a veil or bouquet. She sends the guys off to find a veil, while she and Robin search for a bouquet.
Ted and Marshall decide to gamble and Barney volunteers to look for the veil. A few seconds later Barney comes back with a veil, and he starts talking about having a bachelor party, either a strip club, or a private party. Marshall doesn't want a bachelor party, besides they only have 18 minutes.
18 Minutes Later
The guys run into the wedding chapel lobby and meet up with Lily. Robin walks in wearing a t-shirt with an airbrushed body wearing a swim suit on it. As Lily had asked her earlier to change because she couldn't look prettier than the bride.
They walk up to the receptionist, who is less than enthused about people getting married. The receptionist informs them that in New Jersey, it takes 3 days to obtain a marriage license. She suggest they go to the court house, they can get the waiting period waived if they have a good enough reason.
The gang is waiting in a very long line. Ted's eyes keep straying to Robin's drawn shirt boobs and not listening to her talk. A group of Chinese men approach Barney again, obviously knowing who he is, and have a conversation with him in Chinese.
Lily and Marshall finally get to the front of the line, but cannot get their waiting period waived, only a judge may allow that. Lily decides to stake out the restrooms and wait for a judge to walk by.
Ted pulls Robin aside and asks her if they can "do it." Robin is appalled and she knows it only because of the shirt, but decides to anyway.
A judge finally goes into the Men's Restroom, and Lily runs in after him.
Marshall and Lily are trying to convince the judge to waive the waiting period. He states that he'd usually not waive the period but he is impressed by the couple. The fact that they've stood besides each other for all these years. The judge then sees a strange look on Barney's face ande ask him what the problem is. Barney reveals that Lily left Marshall over the summer. He reveals this secret because he believes that being in a courthouse immediately makes him under oath.
Back at the Casino
Marshall decides to give up as they won't be able to find anyone. Lily comes up with a brilliant idea to get married at sea in international waters. There is no restrictions getting married out there, they simply need to find a ship captain.
Lily and Robin go off to look for a ship captain, while Ted and Marshall play blackjack, and Barney follows. Right away, the guys find a ship captain. The captian agrees to marry them for a fee of $5000. Lily agrees and tries to get the gang to fork up the money, which they don't have.
Barney tells them that he can get the money. The Chinese men that have been coming up to him are his old gambling buddies, and he used to have a gambling problem playing a Chinese game. So he says he'll play and get them the money.
A wheel is being turned, and a bunch of men are sitting around a table with cards and stacks of chips. Each one by one putting a new stack of chips into the game, and matching each other's chips. The dealer pulls out a stack of tiles, and gives a few to each player. They all look at their tiles. They then get up and trade seats with another player. The dealer shakes a cup and puts down some dice. Then Barney calls out for the wheel to be spun. The wheel stops, and a player leaves the table. No one understands the game, until Marshall says he does, and gives Barney a tip, which Barney follows. And goes all in, so does the rest of the men. 3 women stand next to Barney, each with both their fists out, and Barney chooses a fist. The woman opens her fist to reveal... a jelly bean. Barney wins.
On the boat
The ship captian starts the wedding ceremony, but Lily and Marshall realize that they don't want to do this. They want to make it an amazing wedding in front of their families and friends. Lily is ready to face Marshall's family. The captain, then says, he pronounces them Man and Wife. Lily and Marshall yell at him, and he un-pronounces it.
And that is the story of how Marshall and Lily were married for 12 seconds, somewhere off the coast of Atlantic City.