Seattle has the inside track if they simply win that last game of the season at home vs the Rams. They will have the division tie breaker.
The really odd thing about it all is the 49ers at 4-8 are still very much in it. They play Seattle at home and the Rams on the road and finish against that pathetic Arizona team. They have a tough game on the road vs San Diego, who will most likely still be in the playoff hunt (barring a loss to KC this weekend). So at 7-9 and a 5-1 division record, they would win the tie breaker over both Seattle and the Rams.
I will put it this way, if the 49ers handle business against the Seahawks (expected to), and then pull off the win at St. Louis 2 weeks later, they will win the West at 7-9.