The Bills didn't just need a miracle from Andy Dalton to get into the playoffs this year, they also got some help from the NFL rulebook in the form a tiebreaker that hadn't been used to decide a playoff spot in seven years. 

After the Bills beat the Dolphins 22-16 on Sunday, the path to the playoffs for Buffalo was simple: If the Bengals beat the Ravens, then the Bills would get in. If the Ravens beat the Bengals, then the Bills would be out. 

With 52 seconds left to play in the game, and the Bengals facing a fourth-and-12, things weren't looking great for the Bills, but that quickly changed when Dalton threw a pass that will likely make him the most popular person in Buffalo for years to come. 

The 49-yard touchdown pass to Tyler Boyd gave the Bengals a 31-27 win over Baltimore and put the Bills in the playoffs for the first time since 1999. 

At 9-7, the Bills got into the postseason over the Ravens, who were also 9-7. The Bills also got in over the 9-7 Chargers, despite the fact that L.A. had beaten them earlier this year. Oh, and let's not forget that the Titans also finished 9-7, which set up a wild four-team tiebreaker. 

The NFL has a long list of rules that's supposed to be used in a scenario like this and that's exactly what happened. Some tiebreakers -- like a coin toss -- are rarely used, but they're on the list just in case things get funky. In the case of the Bills, they actually got in on one of those rarely-used tiebreakers. 

Let's start with the fifth seed in the AFC, which was earned by Tennessee. The Titans got the fifth spot thanks to a pretty common tiebreaker: Conference record. Tennessee's 8-4 mark in the AFC was better than the Bills (7-5), Ravens (7-5) and Chargers (6-6). 

Now, this is where things get interesting. The fact that the Chargers had a head-to-head win over Bills didn't matter in the tiebreaker for the sixth spot because it was a three-way tie. In that case, conference record is used, which eliminated the Chargers because they had the worst AFC record out of the three teams. 

That left the Bills and Ravens. 

Since both teams went 7-5 in the AFC, that takes us to our next tiebreaker, which is, "Best won-lost-tied percentage in common games." The two teams played five common games this season, and they BOTH went 4-1. So yup, we have another tie, so we have to move on to the next tiebreaker. 

The next tiebreaker is based on strength of victory. The Bills finished the season with a .396 strength of victory, which gave them the sixth spot over the Ravens, who finished with a .299 strength of victory. 

Getting into the playoffs based on the strength of victory tiebreaker doesn't happen often. Before this year, the last team to qualify for the postseason based on strength of victory was Green Bay. In 2010, the Packers edged the Giants for the final spot in the NFC, and here's the good news for Buffalo: Green Bay went on to win the Super Bowl that year.