No.8 Morgan Allen had powered over within six minutes to give Scarlets the lead, and after Steven Shingler departed injured, Aled Thomas turned the screw with three penalties, only for Edinburgh to surge back into contention.
Thomas added his fourth penalty in the dying moments to give the Llanelli outfit the narrowest of victories, 22-21 and deny Edinburgh a brave away win.
Scarlets remain in fourth after Leinster's 52-0 bonus point win against Zebre, but stretched their lead over fifth-placed Edinburgh.
And Pivac knows how crucial the victory could prove ahead of two tricky games on the road.
"We're obviously happy and relieved. It was really important to get a win with a couple of away games coming up," Pivac said.
"We were certainly disappointed to fall behind 21-19. That was a massive result; there was a big improvement but still some errors clearly.
"We had always targeted the home games during this period until the Six Nations are over; this evening's game and Treviso. Both are must wins.
"With the two away games we'll take every point we can. We'll be fighting hard for every point and trying hard to maximize our opportunities. We want to stay in the top four and not chase the pack like we had to last season."
To buy tickets for the GUINNESS PRO12 Grand Final click here. Also follow us on Facebook, join the conversation on Twitter, sign up to our YouTube channel for extensive match highlights and sign up for our newsletter for regular updates on the GUINNESS PRO12.