Which of the following two versions is correct? Or are both of them incorrect?
The one who ate all nuts was Squirrel.
Both, kind of. It's an adverbial noun (noun that can behave like an adverb), so you can treat it like you would any other number + counter.
So your first sentence is almost correct (skip the に):
Alternatively, you can use の instead to use it attributively (but not な):