Jim Harbaugh, left, of the 49ers and brother John Harbaugh of the Ravens both made eye-raising moves late in the season and the gamble paid off for both coaches, who will be matched against each other in the Super Bowl. (Mark Humphrey, Matt Slocum/Associated Press)

The Harbaugh vs. Harbaugh matchup is definitely the most intriguing story line of the Baltimore-San Francisco Super Bowl. That’s what happens when head coaching brothers — Baltimore’s John and San Francisco’s Jim — meet for the first time in the NFL’s biggest event. And the guts the Harbaughs displayed in leading their teams to the championship game should only add to the interest.

In making two key, late-season changes on offense, the Harbaughs gambled — and their teams won big.

Jim rolled the dice first. He made the controversial call to stick with former backup quarterback Colin Kaepernick after Alex Smith, San Francisco’s starter in last season’s NFC title game loss in overtime to the New York Giants, had recovered from a concussion. Jim figured the speedy, athletic Kaepernick was the right guy to help the 49ers take a bigger step this season. Clearly, Jim nailed that one.

John was no less on point in his assessment of what Baltimore needed. With the Ravens in a three-game slide in mid-December, he fired offensive coordinator Cam Cameron and promoted quarterbacks coach Jim Caldwell. Baltimore’s offense has surged in the postseason — and quarterback Joe Flacco has never played better.

Kaepernick and Caldwell were put into position to succeed because the Harbaughs weren’t afraid to fail. That’s uncommon in the coaching business. By nature, NFL head coaches are reluctant to take major risks. When you’re leading one of only 32 teams in professional sports’ most lucrative business, it’s better for job security to play it safe whenever possible.

But the Harbaughs aren’t the let’s-just-hang-on-to-our-jobs types. The sons of a successful college coach (Jack Harbaugh led Western Kentucky to the 2002 Football Championship Subdivision national title), John and Jim are in it for the top prize. For Jim, the decision to ride with Kaepernick wasn’t just about trying to win this season’s Lombardi Trophy. Jim’s goal is to collect a bunch of them. He didn’t think that would be possible with Smith leading the 49ers’ offense.

Selected first overall in 2005, Smith was considered a draft bust. Then Jim, after a successful stint at Stanford, was hired to coach the 49ers before the 2011 season. Together they revived Smith’s career. Smith became an efficient, albeit not spectacular, passer as he helped the 49ers win the NFC West title. San Francisco also defeated New Orleans in the playoffs before falling short of a berth in the Super Bowl.

There’s an unwritten rule in the NFL that players don’t lose their position because of injury. That’s why there was closed-door grumbling in the 49ers’ locker room after Jim rolled with Kaepernick for Week 11 — and didn’t switch back to Smith after the seven-year veteran was medically cleared to play. Smith had proven himself to his teammates and was having the best season of his career (guys with 104.1 passer ratings are seldom benched) when Jim pushed him aside for an untested second-year player.

If Kaepernick had failed, Jim could have lost the locker room. That’s one of the fastest ways to wind up back on the coaching interview circuit. Jim was a big-time college quarterback at Michigan. He played for Chicago, Indianapolis, Baltimore and San Diego in a 14-year NFL career. No one needed to explain to him the risks involved with his Smith-Kaepernick decision. It was because of Jim’s expertise at the position, however, that he knew what should be done for the good of the franchise. So he did it.

With Kaepernick at the controls, Jim envisioned the 49ers’ offense evolving into something special. Kaepernick, Washington’s Robert Griffin III and Seattle’s Russell Wilson represent the best of the NFL’s new breed of dual-threat quarterbacks. They’re almost as fast as Michael Vick was in his prime — and more accurate throwing the ball than Vick ever dreamed of being.

Kaepernick has caused fits for defensive coordinators as he directs the same type of read-option plays Redskins fans grew accustomed to seeing. He mostly played brilliantly as San Francisco won its second consecutive NFC West title.

Kaepernick set a record for the most rushing yards by quarterback with 181 in a playoff victory over Green Bay. He was superb (a 127.7 passer rating fits the description) Sunday as San Francisco overcame a 17-point deficit against Atlanta in the NFC title game. And he’s only 25.

“He just played great,” Jim said repeatedly while describing Kaepernick’s performance to reporters after Sunday’s title game. “I don’t even know the words to say it . . . just a great performance by the quarterback.”

Jim’s brother also has benefited from great quarterback play. It’s no coincidence that Flacco’s rise coincided with Caldwell’s change in status.

Cameron was fired on Dec. 10. The Ravens were 9-4 and leading the AFC North, which they wound up winning, by two games. Teams in much worse shape wait at least until the regular season ends to start jettisoning coaches. And the move was even more surprising because Baltimore scored 28 points in a loss the day before to Washington. The Ravens’ defense was their biggest problem against the Redskins.

For John to have made such a big in-season move, he and other Ravens decision-makers clearly must have been alarmed about the direction of the offense. Under those circumstances, some would argue John had nothing to lose by shaking up the staff. But the decision could have blown up in his face worse than a botched trick play.

As a head coach, Caldwell, who was in his first season with Baltimore, had led Indianapolis to a Super Bowl. There were no guarantees, however, that Baltimore’s offense would improve under his direction. If the Ravens’ uneven performance on offense continued, John (rightfully) could have been second-guessed by fans and reporters for making such an unconventional move so late in a season.

The outcome? The Ravens have averaged 30 points in their three-game playoff run. Caldwell has called a lot of deep passes, and Flacco — defensive coaches say no NFL quarterback has a stronger arm — has responded with eight touchdown passes and no interceptions. His lowest passer rating during the stretch was 106.2. Flacco’s career rating is 86.3. “And think about this: We’re still getting to know each other,” Caldwell said.

Over the next two weeks, this Super Bowl coaching matchup will be the most scrutinized in the history of the game. And whether it’s called the Brothers Bowl, Bro Bowl or Harbaugh Bowl really doesn’t matter. What’s important is that two of the game’s best coaches reminded us you sometimes have to put yourself on the line to get what you want.

For more by Jason Reid, visit www.washingtonpost.com/reid.